Marigold
Marigold

Application

MarigoldProvider
RouterProvider

Layout

AppLayoutbeta
Aside
Aspect
Breakout
Center
Columns
Container
Grid
Inline
Inset
Scrollable
Split
Stack
Tiles

Actions

ActionBaralpha
Button
Link
LinkButton
ToggleButtonalpha
ToggleButtonGroupalpha

Form

Autocomplete
Calendarupdated
Checkbox
ComboBox
DateField
DatePicker
FileField
Form
Multiselectdeprecated
NumberField
Radio
SearchField
Select
Slider
Switch
TagFieldbeta
TextArea
TextField
TimeField

Collection

SelectList
Tableupdated
Tag

Navigation

Accordion
Breadcrumbs
Pagination
Sidebarbeta
Tabs
TopNavigationbeta

Overlay

ContextualHelp
Dialog
Drawer
Menu
Toastbeta
Tooltip

Content

Badge
Card
Divider
EmptyStatebeta
Headline
Icon
List
Loader
SectionMessage
SVG
Text

Formatters

DateFormat
NumericFormat

Hooks and Utils

cn
cva
extendTheme
parseFormData
useAsyncListData
useListData
useResponsiveValue
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: 17 days 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