Marigold
v18.0.0-beta.4
Marigold
v18.0.0-beta.4

Application

MarigoldProvider
RouterProvider

Layout

AppShellbeta
Aside
Aspect
Center
Columns
Container
Grid
Inline
Inset
Pagebeta
Panelbeta
Scrollable
Split
Stack
Tiles

Actions

Buttonupdated
ButtonGroupbeta
Link
LinkButton
ToggleButtonbeta

Form

Autocomplete
Calendar
Checkbox
ComboBox
DateField
DatePicker
DateRangePickerbeta
FileField
Form
NumberField
Radio
RangeCalendaralpha
SearchField
SegmentedControlbeta
Select
SelectListupdated
Slider
Switchupdated
TagFieldbeta
TextArea
TextField
TimeField

Collection

Cardupdated
Table
Tag
ActionBaralpha

Navigation

Accordion
Breadcrumbs
Pagination
Sidebarbeta
Tabs
TopNavigationbeta

Overlay

ActionMenualpha
ContextualHelp
Dialog
Drawer
Menuupdated
Toastbeta
Tooltip

Content

Badge
Descriptionalpha
Divider
EmptyStatebeta
ErrorStatebeta
Headline
Keyboardbeta
List
Loader
SectionMessage
SVG
Text
TextValuealpha
Titlealpha

Formatters

DateFormat
NumericFormat

Hooks and Utils

cn
cva
extendTheme
parseFormData
useAsyncListData
useLandmark
useListData
useTheme
VisuallyHidden
Components

cn

Helper that combines classnames together.

To combine Tailwind CSS classes with other classes, utilize the cn function within the className attribute to merge them seamlessly. The inputs of the className accept nearly every type. The function itself uses tailwind-merge which is a utility function to easily merge the given tailwind classes. We also use cx function from cva, which combines the class names together. You can pass in arrays, boolean conditions, strings or numbers.

Import

import { cn } from '@marigold/system';

Examples

Conditionally apply classnames

In this example you can see how to use the cn function on a <div> element. Here are written down some Tailwind CSS class names which will be merged with the ones before. So in the end the class names will be rendered (if myValue will be true) as className='flex flex-col cursor-pointer p-4'

const myOtherValue = 'p-4'
...
<div
  className={cn(
    'flex flex-col p-3',
    myValue ? 'cursor-pointer' : 'cursor-not-allowed',
    myOtherValue
  )}
/>

In this code you can see that p-3 will be overwritten by p-4, so keep in mind the order of your class names.

Last update: 4 months ago

NumericFormat

Helper component for formatting numeric based on the current language and locale-specific conventions.

cva

Helper to write styles for an element.

On this page

ImportExamplesConditionally apply classnames