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:
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
classesto add or override utilities: they come last, soclasses: 'w:full'wins over the default width. -
Colors come from the theme families
blue,gray,red,greenandyellow. Redefine them intheme.extend.colorsto restyle every component at once.
Card
-
Pass
classesto add or override utilities: they come last, soclasses: 'w:full'wins over the default width. -
Remove the shadow with
classes: 'sh:none', or tighten it withp:4.
Divider
-
Pass
classesto add or override utilities: they come last, soclasses: 'w:full'wins over the default width. -
Space it with margins:
classes: 'my:8'.
Accordion
-
Pass
classesto add or override utilities: they come last, soclasses: 'w:full'wins over the default width. -
The chevron turns with
group-open:rot:180: reusegroup-open:for your own open styles.
Text field
-
Pass
classesto add or override utilities: they come last, soclasses: 'w:full'wins over the default width. -
classesapplies to the wrapper (label, input and message).
Text area
-
Pass
classesto add or override utilities: they come last, soclasses: 'w:full'wins over the default width. -
Resizing is vertical (
rsz:y); the minimum height is 96 px.
Select
-
Pass
classesto add or override utilities: they come last, soclasses: 'w:full'wins over the default width.
Checkbox
-
Pass
classesto add or override utilities: they come last, soclasses: 'w:full'wins over the default width. -
The check color follows
accent:blue-700.
Switch
-
Pass
classesto add or override utilities: they come last, soclasses: 'w:full'wins over the default width. -
The track uses
peer-checked:bg:blue-700; the thumb slides withpeer-checked:tx:5.
Radio group
-
Pass
classesto add or override utilities: they come last, soclasses: 'w:full'wins over the default width. -
Lay options in a row with
classes: 'md:fd:row md:gap:6'.
Alert
-
Pass
classesto add or override utilities: they come last, soclasses: 'w:full'wins over the default width. -
Colors come from the theme families
blue,gray,red,greenandyellow. Redefine them intheme.extend.colorsto restyle every component at once.
Badge
-
Pass
classesto add or override utilities: they come last, soclasses: 'w:full'wins over the default width. -
Colors come from the theme families
blue,gray,red,greenandyellow. Redefine them intheme.extend.colorsto restyle every component at once.
Spinner
-
Color it through the text color of a parent (
c:blue-700) or withclasses.
Progress bar
-
Pass
classesto add or override utilities: they come last, soclasses: 'w:full'wins over the default width. -
Change the bar color in your theme (
blue-700).
Empty state
-
Pass
classesto add or override utilities: they come last, soclasses: 'w:full'wins over the default width. -
Remove the dashed border with
classes: 'bw:0'.
Avatar
-
Pass
classesto add or override utilities: they come last, soclasses: 'w:full'wins over the default width. -
Use another color for initials:
classes: 'bg:green-100 c:green-900'.
Tooltip
-
Pass
classesto add or override utilities: they come last, soclasses: 'w:full'wins over the default width.
Data table
-
Pass
classesto add or override utilities: they come last, soclasses: 'w:full'wins over the default width. -
Cells take any component: put a
JxBadgeor aJxButtonin a row.
Breadcrumbs
-
Pass
classesto add or override utilities: they come last, soclasses: 'w:full'wins over the default width.
Pagination
-
Pass
classesto add or override utilities: they come last, soclasses: 'w:full'wins over the default width.
Modal
-
Pass
classesto add or override utilities: they come last, soclasses: 'w:full'wins over the default width. -
The backdrop is dimmed and blurred with
backdrop:classes.
Drawer
-
Pass
classesto add or override utilities: they come last, soclasses: 'w:full'wins over the default width. -
Change the width with
classes: 'w:[min(32rem,100%)]'.
Combobox
-
Pass
classesto add or override utilities: they come last, soclasses: 'w:full'wins over the default width. - The input shares the styles of the text field.
Toast
-
Pass
classesto add or override utilities: they come last, soclasses: 'w:full'wins over the default width. -
Move the stack with
position, or withclasseson the region.
Tabs
-
Pass
classesto add or override utilities: they come last, soclasses: '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
classesto add or override utilities: they come last, soclasses: 'w:full'wins over the default width. - The trigger uses the button styles; the list the surface border and shadow of cards.
Steps
-
Pass
classesto add or override utilities: they come last, soclasses: 'w:full'wins over the default width. -
Complete and current steps use
blue-700, upcoming ones the muted border.
Stat
-
Pass
classesto add or override utilities: they come last, soclasses: 'w:full'wins over the default width. - The tile uses the card surface; combine several in a grid.
Segmented control
-
Pass
classesto add or override utilities: they come last, soclasses: 'w:full'wins over the default width. - The selected segment is white on the gray track, with the shared focus ring.
Slider
-
Pass
classesto add or override utilities: they come last, soclasses: 'w:full'wins over the default width. -
The track takes the primary color through
accent:.
Date field
-
Pass
classesto add or override utilities: they come last, soclasses: 'w:full'wins over the default width. -
The picker follows dark mode through the new
scheme:utility (dark:scheme:dark).