Components

Customization

Restyle one instance with classes, or every component at once with the theme. No component needs to be copied or forked.

One instance: classes

Most components accept classes. They are appended after the component classes, so a utility you pass wins over the default one of the same property:

JxButton(classes: 'w:full br:full', onClick: save, [.text('Save')])

Every instance: the theme

Components use the theme families blue, gray, red, green and yellow. Redefine their shades in jx.yaml to restyle every component at once:

jx.yaml
theme:
  extend:
    colors:
      blue: '#0EA5E9'
      blue-100: '#E0F2FE'
      blue-700: '#0369A1'

The Theme Studio previews a few components with your colors before you copy the YAML.

Dark mode

Component surfaces carry dark: variants. They follow the dark_mode of your project: the system setting, or a dark class on <html>.

Per component

Button

  • Pass classes to add or override utilities: they come last, so classes: 'w:full' wins over the default width.
  • Colors come from the theme families blue, gray, red, green and yellow. Redefine them in theme.extend.colors to restyle every component at once.

Card

  • Pass classes to add or override utilities: they come last, so classes: 'w:full' wins over the default width.
  • Remove the shadow with classes: 'sh:none', or tighten it with p:4.

Divider

  • Pass classes to add or override utilities: they come last, so classes: 'w:full' wins over the default width.
  • Space it with margins: classes: 'my:8'.

Accordion

  • Pass classes to add or override utilities: they come last, so classes: 'w:full' wins over the default width.
  • The chevron turns with group-open:rot:180: reuse group-open: for your own open styles.

Text field

  • Pass classes to add or override utilities: they come last, so classes: 'w:full' wins over the default width.
  • classes applies to the wrapper (label, input and message).

Text area

  • Pass classes to add or override utilities: they come last, so classes: 'w:full' wins over the default width.
  • Resizing is vertical (rsz:y); the minimum height is 96 px.

Select

  • Pass classes to add or override utilities: they come last, so classes: 'w:full' wins over the default width.

Checkbox

  • Pass classes to add or override utilities: they come last, so classes: 'w:full' wins over the default width.
  • The check color follows accent:blue-700.

Switch

  • Pass classes to add or override utilities: they come last, so classes: 'w:full' wins over the default width.
  • The track uses peer-checked:bg:blue-700; the thumb slides with peer-checked:tx:5.

Radio group

  • Pass classes to add or override utilities: they come last, so classes: 'w:full' wins over the default width.
  • Lay options in a row with classes: 'md:fd:row md:gap:6'.

Alert

  • Pass classes to add or override utilities: they come last, so classes: 'w:full' wins over the default width.
  • Colors come from the theme families blue, gray, red, green and yellow. Redefine them in theme.extend.colors to restyle every component at once.

Badge

  • Pass classes to add or override utilities: they come last, so classes: 'w:full' wins over the default width.
  • Colors come from the theme families blue, gray, red, green and yellow. Redefine them in theme.extend.colors to restyle every component at once.

Spinner

  • Color it through the text color of a parent (c:blue-700) or with classes.

Progress bar

  • Pass classes to add or override utilities: they come last, so classes: 'w:full' wins over the default width.
  • Change the bar color in your theme (blue-700).

Empty state

  • Pass classes to add or override utilities: they come last, so classes: 'w:full' wins over the default width.
  • Remove the dashed border with classes: 'bw:0'.

Avatar

  • Pass classes to add or override utilities: they come last, so classes: 'w:full' wins over the default width.
  • Use another color for initials: classes: 'bg:green-100 c:green-900'.

Tooltip

  • Pass classes to add or override utilities: they come last, so classes: 'w:full' wins over the default width.

Data table

  • Pass classes to add or override utilities: they come last, so classes: 'w:full' wins over the default width.
  • Cells take any component: put a JxBadge or a JxButton in a row.

Breadcrumbs

  • Pass classes to add or override utilities: they come last, so classes: 'w:full' wins over the default width.

Pagination

  • Pass classes to add or override utilities: they come last, so classes: 'w:full' wins over the default width.

Modal

  • Pass classes to add or override utilities: they come last, so classes: 'w:full' wins over the default width.
  • The backdrop is dimmed and blurred with backdrop: classes.

Drawer

  • Pass classes to add or override utilities: they come last, so classes: 'w:full' wins over the default width.
  • Change the width with classes: 'w:[min(32rem,100%)]'.

Combobox

  • Pass classes to add or override utilities: they come last, so classes: 'w:full' wins over the default width.
  • The input shares the styles of the text field.

Toast

  • Pass classes to add or override utilities: they come last, so classes: 'w:full' wins over the default width.
  • Move the stack with position, or with classes on the region.

Tabs

  • Pass classes to add or override utilities: they come last, so classes: 'w:full' wins over the default width.
  • The selected tab is underlined with blue-700 (a right border when vertical), like the other active states.

Dropdown menu

  • Pass classes to add or override utilities: they come last, so classes: 'w:full' wins over the default width.
  • The trigger uses the button styles; the list the surface border and shadow of cards.

Steps

  • Pass classes to add or override utilities: they come last, so classes: 'w:full' wins over the default width.
  • Complete and current steps use blue-700, upcoming ones the muted border.

Stat

  • Pass classes to add or override utilities: they come last, so classes: 'w:full' wins over the default width.
  • The tile uses the card surface; combine several in a grid.

Segmented control

  • Pass classes to add or override utilities: they come last, so classes: 'w:full' wins over the default width.
  • The selected segment is white on the gray track, with the shared focus ring.

Slider

  • Pass classes to add or override utilities: they come last, so classes: 'w:full' wins over the default width.
  • The track takes the primary color through accent:.

Date field

  • Pass classes to add or override utilities: they come last, so classes: 'w:full' wins over the default width.
  • The picker follows dark mode through the new scheme: utility (dark:scheme:dark).