Coming from shadcn/ui
Most of what you know from shadcn/ui carries over. This page starts with what changes everywhere, then goes through the components one by one, and ends with the contrast changes that apply across the library.
Some differences come from running on the server with Thymeleaf instead of in React; the others are deliberate, mostly for accessibility.
What carries over
Section titled “What carries over”- Names. The component and part names map one to one (
CardHeaderis<sl:card-header>), and so do the variant and size names (variant="outline" size="sm"). Porting an example is mostly a matter of renaming tags. - Theme. The colour tokens are shadcn’s, verbatim: a theme from tweakcn or the shadcn theme generator drops in unchanged.
- Styles. The skins are shadcn’s styles, all eight of them:
shadleaf.skin=vega(the default),nova,maia,lyra,mira,luma,seraandrhea; Skin lists them. One more is Shadleaf’s own:sketch, which looks hand-drawn, for mockups.
At a glance
Section titled “At a glance”| shadcn/ui | Shadleaf |
|---|---|
<Button asChild><a href="/orders"> |
<sl:button as="a" th:href="@{/orders}"> |
className="border-b" to change a component |
a prop: <sl:card-header border> |
<Button> submits the form it is in |
<sl:button> is type="button"; write type="submit" |
open/onOpenChange, value/onValueChange |
the server renders the state; th:field binds form controls |
<DialogTrigger>, <DialogClose> |
commandfor and command on any button |
<Toaster /> and toast("...") |
<sl:toaster>; the server sends the sl-toast event |
ThemeProvider and a copied ModeToggle |
the theme script and <sl:theme-toggle/> |
<TableRow>, <TableCell>, … |
plain tr and td inside <sl:table> |
<Alert> always has role="alert" |
no role unless you add it |
data-slot="card-header" |
class="card-header" |
What changes everywhere
Section titled “What changes everywhere”as instead of asChild
Section titled “as instead of asChild”There is no asChild. A component that can render as a link takes as="a":
<!-- shadcn: <Button asChild><a href="/orders">Orders</a></Button> --><sl:button as="a" th:href="@{/orders}">Orders</sl:button><sl:button as="label"> is a label that looks like a button, for a control that is visually hidden, such as a file
input (for points at it).
Props instead of utility classes
Section titled “Props instead of utility classes”shadcn styles its components with Tailwind classes compiled into your application. Shadleaf ships its own stylesheet, which defines no utility classes, so it works in an application that does not compile Tailwind at all. Where a shadcn example relies on a utility class to change a component, Shadleaf has a prop instead:
| shadcn/ui | Shadleaf |
|---|---|
<CardHeader className="border-b"> |
<sl:card-header border> |
<Empty className="border border-dashed"> |
<sl:empty border> |
<Spinner className="size-8" /> |
<sl:spinner size="32"/> |
<Attachment className="w-full"> |
<sl:attachment full-width> |
<Skeleton className="h-4 w-full" /> |
<sl:skeleton/> (a line is the default), shape="circle" for an avatar |
Your own classes still work: class is appended to the component’s own, so class="w-64" sizes a skeleton when your
application compiles Tailwind. See the adjustability ladder.
The server renders the state
Section titled “The server renders the state”There are no controlled props or change callbacks: no open/onOpenChange, value/onValueChange,
onCheckedChange or onSelect. The server renders the state (open, checked, active, or th:field on a form
control), and the browser reports changes with its own events (change, toggle) or Shadleaf’s sl- events
(sl-tabs-show, sl-theme-change, sl-sidebar-toggle).
Form controls are real form elements: th:field binds them, and the form submits them without a hidden input.
Native elements instead of Radix
Section titled “Native elements instead of Radix”Where shadcn builds a component from Radix or Base UI primitives, Shadleaf uses the browser’s own element. Most of the differences on this page follow from that:
| Component | Built on |
|---|---|
| Dialog, alert dialog, sheet | <dialog>, opened with invoker commands |
| Dropdown menu, popover, tooltip | the Popover API, placed with CSS anchor positioning |
| Select, combobox | <select> |
| Checkbox, radio group, switch | <input type="checkbox"> and <input type="radio"> |
| Toggle, toggle group | checkboxes and radio buttons |
| Calendar, date picker | <input type="date"> |
| Accordion, collapsible | <details> and <summary> |
| Sidebar | one <nav popover> |
A button does not submit by default
Section titled “A button does not submit by default”<sl:button> renders type="button"; shadcn’s Button leaves the type out, so it submits the form it is in. Write
type="submit" on the button that should submit. See Button.
An alert is not announced by default
Section titled “An alert is not announced by default”shadcn’s Alert always has role="alert", so a screen reader interrupts the user to read it. Most alerts are part of
the page when it loads, where that interruption helps nobody. Add role="alert" yourself when an alert appears later,
for example in an htmx response. See Alert.
Rendering fails without an accessible name
Section titled “Rendering fails without an accessible name”Rendering fails when a component that needs an accessible name has none, such as an icon-only button without an
aria-label.
Left and right follow the text direction
Section titled “Left and right follow the text direction”side="right" and "left" on a sheet, dropdown menu, popover, tooltip or sidebar are the end and the start of a line,
so they swap on a right-to-left page.
Markup: class names, not data-slot
Section titled “Markup: class names, not data-slot”The rendered markup uses class names (class="card-header") where shadcn uses data-slot="card-header", and a
data-variant or data-size attribute only when the value is not the default. It matters only if you port CSS written
against shadcn’s markup.
Overlays
Section titled “Overlays”Dialog
Section titled “Dialog”A dialog is the browser’s <dialog> element, so DialogContent, DialogOverlay and DialogPortal are all
<sl:dialog>. There is no DialogTrigger or DialogClose, and no open/onOpenChange state: every dialog has an
id, and any button opens or closes it with commandfor and command:
<!-- shadcn: <DialogTrigger asChild><Button variant="outline">Edit</Button></DialogTrigger> --><sl:button variant="outline" commandfor="edit-profile" command="show-modal">Edit</sl:button><!-- shadcn: <DialogClose asChild><Button variant="outline">Cancel</Button></DialogClose> --><sl:button variant="outline" commandfor="edit-profile" command="close">Cancel</sl:button>openon<sl:dialog>opens it when it is rendered (for a dialog htmx fetches), and the server closes it with thesl-dialog-closeevent.- The title is a
divwithrole="heading"andaria-level="2"(Radix renders anh2), so an application’s ownh2styles do not reach it. - Content taller than the screen scrolls inside the dialog.
- An addition for htmx: shadcn has no body part.
<sl:dialog-body>(and<sl:sheet-body>) is the content between the header and the footer, which scrolls by itself, and the target for htmx. A request into it opens the dialog or sheet at once, shows a spinner until the answer is in, and reports a failure as a toast or in the dialog. Without a body, the content goes straight into the dialog, as in shadcn. See Dialog.
See Dialog.
Alert dialog
Section titled “Alert dialog”<sl:alert-dialog> is the same <dialog> element with role="alertdialog", opened the same way, and a click
outside does not close it. AlertDialogCancel is <sl:alert-dialog-cancel>: it closes the dialog, takes the focus
when it opens (as Radix’s Cancel does) and says “Cancel” unless you give it text. AlertDialogAction has no part: in a
server-rendered page the action submits a form or sends an htmx request, so it is a plain <sl:button>:
<!-- shadcn: <AlertDialogCancel>Cancel</AlertDialogCancel> --><sl:alert-dialog-cancel/><!-- shadcn: <AlertDialogAction variant="destructive">Delete</AlertDialogAction> --><sl:button variant="destructive" type="submit">Delete</sl:button>shadcn’s destructive example colours the media with className="bg-destructive/10 text-destructive"; Shadleaf has
<sl:alert-dialog-media variant="destructive">.
In a small alert dialog, shadcn puts the buttons in two equal columns, whatever their labels; a long label then runs out of its button. Shadleaf stacks the buttons, the action on top, when a label doesn’t fit in its half. See Alert Dialog.
<sl:sheet> is a dialog on an edge of the screen, with SheetTrigger and SheetClose replaced by commandfor, as
for the dialog.
- Content between the header and the footer gets the sheet’s inline padding, where shadcn’s examples wrap it in a
divwithpx-4.<sl:sheet-body>is the same addition for htmx as the dialog’s body. side="right"and"left"swap on a right-to-left page.<sl:sheet-footer show-close-button>adds an outline Close button, as the dialog footer does.- With reduced motion the sheet only fades.
See Sheet.
Dropdown menu
Section titled “Dropdown menu”The dropdown menu, the popover and the tooltip are the browser’s
popovers, placed next to their trigger with CSS
anchor positioning, so there are no portals and no open/onOpenChange state. <sl:dropdown-menu> renders no
element of its own and needs an id; the trigger part is a <sl:button> with popovertarget, and any other button
opens it with popovertarget too:
<!-- shadcn: <DropdownMenuTrigger asChild><Button variant="outline">Open</Button></DropdownMenuTrigger> --><sl:dropdown-menu-trigger variant="outline">Open</sl:dropdown-menu-trigger>asChild around a sidebar part is as on the trigger, which renders that part with the menu’s attributes:
<!-- shadcn: <DropdownMenuTrigger asChild><SidebarMenuButton size="lg">…</SidebarMenuButton></DropdownMenuTrigger> --><sl:dropdown-menu-trigger as="sidebar-menu-button" size="lg">…</sl:dropdown-menu-trigger><!-- shadcn: <DropdownMenuTrigger asChild><SidebarMenuAction showOnHover>…</SidebarMenuAction></DropdownMenuTrigger> --><sl:dropdown-menu-trigger as="sidebar-menu-action" show-on-hover aria-label="More for Design">…</sl:dropdown-menu-trigger>- A menu item is a button or, with
as="a", a link; there is noonSelect. It does what its attributes say (href,hx-*,type="submit",commandfor) and the menu closes. - Checkbox and radio items show the state the server renders (
checked); there is noonCheckedChangeorvalue. Choosing one sends a request, and the page that comes back shows the new state. - No sub-menus, no
DropdownMenuPortal(the top layer does what the portal is for), nomodal, and noloop: the arrow keys stop at the first and the last item, Radix’s default. - Keyboard focus on a menu item draws the focus ring as well as the accent background, which alone is barely lighter than the menu. The pointer highlights with the background only, as in shadcn.
- Tab closes a menu and moves on to the next control, as the ARIA menu pattern describes; Radix keeps the focus in the menu.
See Dropdown menu.
Popover
Section titled “Popover”<sl:popover> is a popover like the dropdown menu: it renders no element of its own, needs an id, and opens from a
button with popovertarget. There is no PopoverAnchor. A form in a popover can close it with an
HX-Trigger: sl-popover-close response header. See Popover.
Tooltip
Section titled “Tooltip”- There is no
TooltipTriggerand noTooltipProvider: the first element inside<sl:tooltip>is the trigger, anddelaysits on each tooltip. - A tooltip waits 300 ms before it shows on hover (
delay), where shadcn shows it at once, so moving the pointer across a toolbar does not flash every tooltip on the way. Keyboard focus, and the next tooltip right after one hid, still show at once. - The pointer can move onto a tooltip without it hiding, and Escape hides it, as WCAG 1.4.13 asks.
mode="label"is for a tooltip that repeats its trigger’s name, such as an icon button’saria-label: it is hidden from screen readers instead of describing the trigger with the same words. shadcn has no such option.
See Tooltip.
th:fieldgoes on<sl:field>(or<sl:field-set>), which wires up the label’sfor, the control’sid,aria-describedbyandaria-invalid, and the field’sdata-invalid. In shadcn you sethtmlFor,id,aria-invalidanddata-invalidyourself.<sl:field-error/>reads the binding’s messages; there is noerrorsprop. Content of your own replaces them, aschildrendo in shadcn.- The error has no
role="alert": after a full page load every error would be announced at once. The control is described by its error instead. - The field has no
role="group", which gave every field an unnamed group. A set of options is a<sl:field-set>. - In an invalid field, only the label (or legend) and the error turn destructive; shadcn colours all the field’s text.
- No
data-disabledon the field: its label fades by itself when the control is disabled, also by a<sl:field-set disabled>. The description does not fade. - No
FieldTitle,FieldSeparatoror choice cards (a field inside a label) yet.
Input, checkbox, radio group and switch
Section titled “Input, checkbox, radio group and switch”<sl:input>only takes the text-like types (text,email,password,date,file, …). Checkboxes, radio buttons and switches are separate components, as in shadcn, but shadcn’sInputwould accepttype="checkbox".- Checkbox, radio group and switch are the browser’s own inputs, styled, where shadcn builds them from buttons. They
submit with the form without a hidden input of their own,
th:fieldbinds them, and the keyboard works as it does on any radio button or checkbox. The indeterminate state is the input’s own (indeterminateprop, or the DOM property) and shows a minus; shadcn’s checkbox shows its check mark forchecked="indeterminate". <sl:native-select>takes<option>and<optgroup>as they are; there is noNativeSelectOption.- A disabled checkbox fades as a whole, check mark included. In the lyra and nova skins a disabled native select and select get the same grey background as a disabled input (shadcn’s lyra and nova only give it to input and textarea).
Input group
Section titled “Input group”className="border-b"(orborder-t) on a block addon is itsborderprop, and theml-autoof shadcn’s examples is not needed: in an addon above or below the control,<sl:input-group-text>takes the free space.- A disabled control fades the whole group by itself, where shadcn’s needs
data-disabledon the group. - Only
<sl:input-group-input>and<sl:input-group-textarea>are controls: there is nodata-slot="input-group-control"for a control of your own. - A click on an addon focuses the control only with JavaScript.
Form additions
Section titled “Form additions”- An input, textarea or native select with
th:fieldmarks itselfaria-invalidwhen its field has errors, so the invalid style needs no markup of yours. <sl:form>is a<form>that passes every attribute on. shadcn has no form component any more (its oldFormwrapped react-hook-form, and its forms now useFieldwith the form library of your choice). Withvalidate, it validates each field on the server as the user types (htmx 4), where shadcn’s examples validate in the browser with a Zod schema.<sl:form-errors/>shows the binding’s global errors (reject(...), a class-level constraint), or withshow="all"every error, as a destructive alert above the fields. shadcn has no such component; you would write anAlertwith the messages yourself.- A read-only input or textarea gets a muted background and no shadow; shadcn draws it as an editable one.
- In Windows’ high-contrast mode a disabled control turns the system’s grey text colour (
GrayText) instead of fading. <sl:button loading>shows a spinner, disables the button and announces the busy state. In shadcn you put aSpinnerin the button and disable it yourself.
Select
Section titled “Select”<sl:select> renders a <select>, so th:field binds it and the form submits it without a hidden input. The
customizable select (appearance: base-select) draws its list where the browser has it (Chrome and Edge 135, Safari
27); elsewhere a small Alpine component shows a list box in its place, and without Alpine it is the browser’s own
select.
<!-- shadcn: <Select><SelectTrigger><SelectValue placeholder="Select a fruit"/></SelectTrigger> <SelectContent><SelectGroup><SelectLabel>Fruits</SelectLabel> <SelectItem value="apple">Apple</SelectItem>... --><sl:select th:field="*{fruit}" placeholder="Select a fruit"> <sl:select-group label="Fruits"> <sl:select-item value="apple">Apple</sl:select-item> </sl:select-group></sl:select>SelectTrigger,SelectValueandSelectContentare all<sl:select>:sizeandplaceholderare its props.- A group’s heading is
<sl:select-group label>; there is noSelectLabelpart. - The list is at least as wide as the select and opens below it, or above it when there is no room, where shadcn’s
default (
position="item-aligned") lays it over the select. No scroll buttons, noposition="item-aligned",sideoralign. - Keyboard focus on an item draws the focus ring as well as the accent background, as in the dropdown menu.
- No
value/onValueChangeoropen/onOpenChange:th:fieldrenders the value, and the select fireschange. - No
multiple, which shadcn’s Select does not have either: use<sl:combobox multiple>,<sl:native-select multiple>or checkboxes. NotextValueon an item: typeahead reads the item’s text. - The keyboard is the browser’s where it draws the list: typing a letter on the closed select chooses the matching item at once, as on any select, where Radix opens the list.
See Select.
Combobox
Section titled “Combobox”<sl:combobox> renders a <select> (a <select multiple> with multiple) holding its items, so th:field binds
one value or a collection and the form submits them without a hidden input. A small Alpine component puts the input,
the chips and the list box in its place; without Alpine it is a select drawn like the native select.
<!-- shadcn: <Combobox items={frameworks}><ComboboxInput placeholder="Select a framework" showClear/> <ComboboxContent><ComboboxEmpty>No items found.</ComboboxEmpty><ComboboxList> {(item) => <ComboboxItem key={item} value={item}>{item}</ComboboxItem>}</ComboboxList> </ComboboxContent></Combobox> --><sl:combobox th:field="*{framework}" placeholder="Select a framework" show-clear> <sl:combobox-item th:each="framework : ${frameworks}" th:value="${framework.id}">[[${framework.name}]]</sl:combobox-item></sl:combobox>
<!-- shadcn: <Combobox multiple ...><ComboboxChips><ComboboxValue>{...<ComboboxChip/>}</ComboboxValue> <ComboboxChipsInput/></ComboboxChips>... --><sl:combobox th:field="*{frameworks}" multiple placeholder="Add a framework">...</sl:combobox>ComboboxInput,ComboboxContent,ComboboxList,ComboboxChips,ComboboxChip,ComboboxChipsInput,ComboboxValueandComboboxTriggerare all<sl:combobox>:showClear,showTriggerandautoHighlightare itsshow-clear,show-triggerandauto-highlight, andComboboxEmptyis itsemptyattribute.- No
itemsarray or render function: the items are<sl:combobox-item>s, whosevalueand text replaceitemToStringValue. A group’s heading is<sl:combobox-group label>; there is noComboboxLabelorComboboxCollection. - An addition:
search-urlloads the options from the server as you type, as an HTML fragment of items. - No popup layout (a button trigger with the input in the list), no input addons, no
showRemoveon a chip (a chip can always be removed), noside/align. No free text either, which Base UI’s Combobox does not allow (its Autocomplete does). - No
value/onValueChangeoropen/onOpenChange:th:fieldrenders the value, and the select fireschange.
See Combobox.
Toggle and toggle group
Section titled “Toggle and toggle group”<sl:toggle> is a checkbox drawn as a button, and the items of <sl:toggle-group> are radio buttons
(type="single") or checkboxes (type="multiple"). So th:field binds them, the form submits them, and they work
without JavaScript; a screen reader announces a toggle as a checkbox, checked or not, where Radix’s is a toggle button,
pressed or not.
<!-- shadcn: <Toggle aria-label="Toggle italic" defaultPressed><Italic/></Toggle> --><sl:toggle name="italic" aria-label="Toggle italic" checked><sl:icon name="italic"/></sl:toggle>
<!-- shadcn: <ToggleGroup type="single" variant="outline" defaultValue="grid"> <ToggleGroupItem value="list">List</ToggleGroupItem>... --><sl:toggle-group th:field="*{layout}" variant="outline" aria-label="Layout"> <sl:toggle-group-item value="list">List</sl:toggle-group-item> <sl:toggle-group-item value="grid">Grid</sl:toggle-group-item></sl:toggle-group>- No
pressed/defaultPressed/onPressedChange, norvalue/defaultValue/onValueChangeon the group:checked(orth:field) renders the state, and the inputs firechange. - The group takes the
th:fieldornameits items share; Radix’s has neither. - The keyboard is the browser’s: in a
singlegroup the arrow keys move between the items and select them, and Tab leaves the group; in amultiplegroup every item is a tab stop. Radix’s arrow keys only move the focus, in both types. There is nolooporrovingFocus. - A
singlegroup cannot be cleared by clicking its item again, as a radio button cannot. spacingtakes0to4, andvariantandsizeare set on the group only, not per item.
Calendar
Section titled “Calendar”<sl:calendar> holds its value in <input type="date"> elements, so th:field binds it and the form submits ISO
dates. A small Alpine component draws the month over them; without Alpine the date inputs show.
<!-- shadcn: <Calendar mode="single" selected={date} onSelect={setDate}/> --><sl:calendar th:field="*{dueDate}"/>
<!-- shadcn: <Calendar mode="range" selected={range} onSelect={setRange} numberOfMonths={2}/> --><sl:calendar aria-label="Stay" number-of-months="2"> <sl:input type="date" th:field="*{checkIn}" aria-label="Check-in"/> <sl:input type="date" th:field="*{checkOut}" aria-label="Check-out"/></sl:calendar>- No
mode: one date input is a single date, two (start and end) are a range. Nomode="multiple"yet. - No
selected/onSelect:th:fieldrenders the value, and the input fireschange. disableddisables the whole calendar, as on an input; the days that cannot be picked aredisabled-dates(sat,sun,2026-12-24..2026-12-31), plus the inputs’minandmax.- The page’s locale sets the first day of the week and the week numbering;
week-starts-onoverrides the first day. - No
timeZone,buttonVariant,classNames,componentsorformatters.
See Calendar, and Date picker and Month view for the two components built on it.
Navigation and disclosure
Section titled “Navigation and disclosure”Accordion and collapsible
Section titled “Accordion and collapsible”Each accordion item and each collapsible is a <details> element with the trigger as its <summary>, so they need
no JavaScript. That changes a few things:
<!-- shadcn: <Accordion type="single" collapsible defaultValue="item-1"> <AccordionItem value="item-1">... --><sl:accordion> <sl:accordion-item open>...</sl:accordion-item></sl:accordion>defaultValueisopenon the item; items have novalue, and there is noonValueChange.type="single"(the default here) is alwayscollapsible: the browser lets the opendetailsclose. The items share aname, which must be unique on the page; one is generated when you give none.- The trigger’s text is a heading (
role="heading",level, 3 by default) inside thesummary, where Radix puts the trigger’s button in anh3. - No arrow keys between accordion triggers (optional in the ARIA pattern): Tab moves between them.
- The trigger must be the first child of its item or collapsible; a collapsible’s trigger cannot sit after its
content.
<CollapsibleTrigger asChild><Button …>is<sl:collapsible-trigger variant="…" size="…">. - A closed disabled item renders no content, as Radix renders no closed content at all.
- No
dirororientation: the accordion follows the page’s direction, and is vertical. Norole="region"on the content, which Radix gives every panel: the ARIA pattern advises against it where many panels can be open at once. - No
open/onOpenChangeon a collapsible:openrenders it open, and the browser’stoggleevent reports changes. - A collapsible’s trigger in shadcn’s examples turns its icon with
group-data-[state=open]:rotate-90; without utility classes, write.collapsible[open] > .collapsible-trigger svg { rotate: 90deg; }in your CSS.
See Accordion and Collapsible.
value is taken in Thymeleaf (th:value), so a trigger and its panel share a tab, and active on <sl:tabs>
names the active one, which the server renders. The tabs need an id, and a trigger with an href is a link that
works without JavaScript:
<!-- shadcn: <Tabs defaultValue="account"><TabsList><TabsTrigger value="account">... --><sl:tabs id="settings" active="account"> <sl:tabs-list><sl:tabs-trigger tab="account">Account</sl:tabs-trigger>...</sl:tabs-list> <sl:tabs-content tab="account">...</sl:tabs-content></sl:tabs>activationModeisactivation-mode; there is noonValueChange(ansl-tabs-showevent fires on the panel that is shown).- There is no
dir(the arrow keys follow the page’s direction), noloop(the arrow keys always wrap around, Radix’s default) and noforceMount(every panel is always in the page). - A panel takes the focus, as in Radix, and shows the focus ring when Tab reaches it; shadcn’s takes the focus without showing it.
- In Windows’ high-contrast mode the active tab is underlined, as its background and shadow are gone there.
See Tabs.
Breadcrumb
Section titled “Breadcrumb”The parts are shadcn’s (BreadcrumbList, -Item, -Link, -Page, -Separator, -Ellipsis).
<sl:breadcrumb-link>is always a link (shadcn’sasChildmakes it a routerLink); a level without a page is plain text in its item.- shadcn’s example wraps the ellipsis in a
DropdownMenuTriggerby hand; here<sl:breadcrumb-ellipsis>withsl:dropdown-menu-items as its content renders that menu and its button itself. The menu button is named “Show more levels” rather than shadcn’s example’s “Toggle menu”. - An ellipsis without a menu is read as “More levels”; shadcn’s is hidden from screen readers (
aria-hidden) even though it holds a visually hidden “More”. - The page shown now is plain text with
aria-current="page". shadcn’s also hasrole="link"andaria-disabled="true", which a screen reader announces as a link that goes nowhere. - The separator turns around on a right-to-left page.
See Breadcrumb.
Pagination
Section titled “Pagination”The parts are shadcn’s (PaginationContent, -Item, -Link, -Previous, -Next, -Ellipsis), and
<sl:pagination th:page="${people}"/> with no content renders them all from a Spring Data Page: links that keep the
request’s other parameters, first and last page, ellipses, Previous and Next disabled at the ends (no href,
aria-disabled).
isActiveisactive.- The ellipsis is not
aria-hidden: it reads “More pages”, where shadcn’s hidden screen-reader text is never read. - The labels are messages (
sl.pagination.*) rather than props such as Previous’stext. - The data table’s footer pieces are components:
sl:pagination-summary(“11–20 of 270”) andsl:pagination-size(a menu of links rather than a select). - There are no first and last page buttons, which shadcn’s dashboard has: the first and the last page are always among the numbers.
See Pagination.
Data display
Section titled “Data display”<sl:table> styles the plain table elements inside it, so there is no TableHeader, TableBody, TableFooter,
TableRow, TableHead, TableCell or TableCaption: write thead, tbody, tfoot, tr, th, td and
caption, with th:each on the row. A page of 50 rows would otherwise be hundreds of components.
- Sorting. Where shadcn’s data table sorts in the browser with TanStack Table,
<sl:table-head sort="name">is a link that asks the server for the page in another order (?sort=name,desc), read from a Spring DataPage. - Filtering is a
GETform the server answers, withsl:query-paramskeeping the order and page size, and htmx to search as the user types (Tables with htmx). There is no column visibility or browser-side paging. - Layout. A cell’s alignment is
data-align="end"rather than atext-rightclass. A dense table issize="sm"on<sl:table>, where shadcn passestext-xsand tighter cell padding as classes. Column pinning is only for the first column, thesticky-first-columnprop on<sl:table>, which is CSS (position: sticky) and not TanStack’scolumn.pin(). - Row selection is the application’s own checkboxes, which submit with a form:
<sl:table-select-all>takes the place of the header’sCheckboxwithtable.getIsAllPageRowsSelected(), and<sl:table-selection-count>of"{n} of {total} row(s) selected."(it reads “2 of 20 selected”). The selected row’s background comes from CSS (a checked checkbox in the row’s first cell), not fromdata-state="selected". The selection covers the page only; a sort or another page starts afresh. See Table. - Row actions are the same dropdown menu in the last cell, but its items post a form around the menu rather than call a function (the data table’s “Copy payment ID” writes to the clipboard), and the column’s header cell has a screen-reader name (“Actions”) where shadcn’s is empty. See Actions per row.
<sl:chart th:data="${rows}"> is ChartContainer with the chart inside it, and its parts are Recharts’ components
with shadcn’s settings: sl:chart-grid (CartesianGrid vertical={false}), sl:chart-x-axis and sl:chart-y-axis
(no tick or axis lines), sl:chart-tooltip (ChartTooltip with ChartTooltipContent), sl:chart-legend and the
series, sl:chart-bar, sl:chart-line and sl:chart-area. Their props are Recharts’ and shadcn’s in kebab case
(indicator, hide-label, label-key, tick-margin, radius; stackId is stack, type is curve, dot is
dots). The chart type follows the series: there is no BarChart to pick. What differs:
- No
ChartConfig. A series’labelandcolorsit on its part, andcolor-darkreplaces the config’stheme, written aslight-dark(). A series without a colour takes the next--chart-N; shadcn’s examples name them in the config. - No
ChartStyle. shadcn writes the--color-<key>properties into a<style>element, which a strict Content-Security-Policy blocks: its chart loses its colours. Shadleaf sets them through CSSOM. A key is therefore checked to be a CSS identifier. - Named formats instead of functions.
tickFormatter,formatterandlabelFormatterareformat,value-formatandlabel-formatwith a name (month-short,compact,currency), written withIntlin the page’s language. Dates are read by their Java type, not bynew Date(), so aLocalDatenever shifts a day. - The chart’s name is an
aria-label, not Recharts’title: a browser shows an svg’s<title>as a native tooltip over the styled one. And the tooltip keeps a gap between a series’ name and its value, which shadcn’s lets touch once the tooltip is wider than its minimum. - A visible focus ring. shadcn hides the chart’s (
outline-hiddenon.recharts-surface); the chart takes the focus for its arrow keys, so each skin draws one. - Recharts 3.10 on Preact, not React, and not the 3.8 shadcn pins: the script is smaller, and 3.10 fixes a line drawn only partway with reduced motion.
- A fixed height is
aspect-ratio: autoand a height in your CSS, shadcn’saspect-auto h-[250px]. - Not there yet: pie, radar and radial charts, horizontal bars, gradients, icons in the tooltip and legend, and custom tooltip or legend content.
See Chart.
Attachment
Section titled “Attachment”The parts and props are shadcn’s.
<AttachmentTrigger asChild>around a link is<sl:attachment-trigger as="a">, and inside aDialogTriggerit is a trigger withcommandforandcommand="show-modal".<sl:attachment-action>takesas="a"too, for a download link.- Where shadcn tells you to add
tabIndex,role="group"and anaria-labelto a group of attachments without actions,<sl:attachment-group label="...">adds all three. - shadcn’s
shimmerandscroll-fade-xutilities are part of the attachment’s stylesheet. - shadcn’s group is only a row; for a gallery you write your own grid around the attachments.
<sl:attachment-group layout="grid">is that grid, its columns and gap from the skin, as the standalone bundle has no utility classes to build one. - The trigger draws the skin’s focus ring around the card, only for keyboard focus; shadcn’s card shows a faint ring whenever anything in it has focus, a click included.
- An uploading or processing attachment is marked
aria-busy, and its title does not shimmer for users who ask for reduced motion or in Windows’ high-contrast mode. A failed attachment’s text uses the legible destructive colour (see Contrast). - The edges of an attachment group stop fading while it has keyboard focus, so its focus ring shows.
See Attachment.
Avatar
Section titled “Avatar”shadcn’s avatar renders the image only once it has loaded in the browser, and the fallback until then. Shadleaf
always renders both, and the stylesheet picks one: the fallback when the image has no src or an empty one, which is
what th:src gives for a user without a photo, needs no script at all. For a photo that is loading or fails to load,
Shadleaf’s script marks the image data-status="loaded" or "error" (where Radix has onLoadingStatusChange), and the
fallback shows until it is loaded, as in shadcn. There is no delayMs. Without JavaScript the image simply lies over
the fallback.
The avatar is hidden from assistive technology unless it has a label, as it usually sits next to the person’s
name. With one, it is announced as a single image with that name.
Card and empty
Section titled “Card and empty”<sl:card-title level="3"> is announced as a heading, so screen reader users can jump between cards. Without a
level it is plain text, as in shadcn. The same goes for <sl:empty-title>.
shadcn’s ghost badge changes colour on hover even when it is a plain label. A Shadleaf badge only reacts to hover, and
takes keyboard focus, when it is a link (as="a").
Skeleton
Section titled “Skeleton”The skeleton is hidden from assistive technology; put aria-busy="true" on the region that is loading.
Feedback
Section titled “Feedback”shadcn’s toast is Sonner: a <Toaster /> in the layout and toast("...") calls in the browser. Shadleaf has
<sl:toaster> in the layout, and the toasts come from the server: an htmx response sends the sl-toast event with
HX-Trigger (htmxResponse.addTrigger("sl-toast", Toast.success("Saved"))), a page renders <sl:toast>s from a flash
attribute after a redirect, or a response swaps them in out of band. A script can dispatch sl-toast itself, with the
same detail as Sonner’s options: {title, description, variant, duration}. toast.success() and friends are the
variant (success, info, warning, error); visibleToasts is visible-toasts.
- A toast shows for 5 seconds, not Sonner’s 4, and its time stops while it has the focus as well as on hover. Every
toast has a close button (Sonner’s
closeButtonis off by default), and there is no swipe to dismiss. - There is no action or cancel button: a toast goes away by itself, so it must not hold the only way to do something.
- An error toast is announced at once (assertive); the others politely, as all of Sonner’s are.
- An error’s icon takes the destructive colour; with Sonner every icon has the text colour unless
richColorsis on. - The toasts move into an open modal dialog, so one shown while a dialog is open can be used and is announced; a Sonner toast outside the dialog is inert there.
See Toast.
Spinner
Section titled “Spinner”<sl:spinner> turns slower, not still, when the user asks for reduced motion; shadcn’s keeps spinning at full speed.
Its name, “Loading”, is a message (sl.spinner.label) you can translate.
Application shell
Section titled “Application shell”Sidebar
Section titled “Sidebar”shadcn’s Sidebar renders a Sheet on a phone and a separate sidebar on a desktop, chosen in the browser by
useIsMobile(). The server does not know the screen’s width, and rendering the navigation twice would double its
markup and its ids, so <sl:sidebar> is one <nav popover>: CSS shows it beside the page from 768 px, and below that
the trigger opens it as the panel (focus in, the rest of the page inert while it is open).
- State. The state lives on
<sl:sidebar-provider>’sdata-state(shadcn also puts it on the sidebar). The cookie issl-sidebar-statewithexpandedorcollapsed(shadcn’ssidebar_stateholdstrueorfalse) for a year instead of a week, and the server reads it:defaultOpenisdefault-state,openisstate, and there is noonOpenChangeoruseSidebar(); thesl-sidebar-toggleevent tells a script. - Side.
side="right"and"left"swap on a right-to-left page, and the trigger’s icon turns round by itself for a sidebar on the end (shadcn’s sidebar-14 addsrotate-180). - Variant and collapsible.
variantis shadcn’s (sidebar,floating,inset) and, as there, changes the desktop only. So doescollapsible:offcanvasandiconas shadcn’s, whilenoneonly keeps the sidebar from collapsing on a desktop and is still the panel on a phone (shadcn’s is a plain column at every width).
See Sidebar.
Sidebar menu parts
Section titled “Sidebar menu parts”The parts inside the sidebar keep shadcn’s names.
<sl:sidebar-menu-button>is a link unlessas="button"(shadcn’s renders a button, andasChildmakes it a link).isActiveisactive, andth:active="${#slNav.current('/people')}"asks the request whether the link is the current page, so no controller has to say so.- The icon goes in the
icon-startslot and the text is wrapped for you (shadcn’s<span>around the label); two lines are two elements, such as<strong>and<small>, as there are no utility classes. tooltip="Home"on a menu button is shadcn’stooltipprop (a string only).<sl:sidebar-content>is adiv, as shadcn’s:<sl:sidebar>is thenav.show-on-hoverisshowOnHover.
Collapsible groups in the sidebar
Section titled “Collapsible groups in the sidebar”A collapsible group needs no Collapsible, CollapsibleTrigger and CollapsibleContent around the item, its button
and its sub-menu: <sl:sidebar-menu-item collapsible> is a details element, its menu button becomes the summary
(with shadcn’s chevron) and <sl:sidebar-menu-sub> the content. defaultOpen is open, usually
th:open="${#slNav.current('/settings')}". SidebarMenuSubButton’s isActive is active, size is shadcn’s
(sm, md), and it is a link unless as="button".
| shadcn/ui block | Shadleaf |
|---|---|
sidebar-07: group-data-[collapsible=icon]:hidden on the projects’ group |
<sl:sidebar-group icon-hidden> |
sidebar-02: a group in a Collapsible with the label as its trigger |
<sl:sidebar-group collapsible> |
sidebar-08: the trigger in a SidebarMenuAction beside a link |
<sl:sidebar-menu-sub collapsible aria-label="...">, whose chevron needs a name of its own (shadcn’s says “Toggle”) |
| sidebar-05: plus and minus | the turning chevron |
Dropdown menus in the sidebar
Section titled “Dropdown menus in the sidebar”A dropdown menu opened from a menu button or a menu action (shadcn’s team switcher, version switcher, NavUser and
the projects’ “More”) is <sl:dropdown-menu-trigger as="sidebar-menu-button"> or as="sidebar-menu-action" (see
Dropdown menu).
- shadcn picks the side in React,
side={isMobile ? "bottom" : "right"}; hereside="right"is enough: in the phone panel (and in the header layout’s row) CSS opens a right or left menu below its trigger, lined up with its end. - shadcn’s
data-[state=open]:bg-sidebar-accenton the team switcher is built in: an open trigger has the active look, and its menu is at least as wide as the trigger (w-(--radix-dropdown-menu-trigger-width) min-w-56). - The current team is a checked radio item (shadcn’s team switcher marks none, its version switcher draws a check icon).
- The team switcher’s shortcuts (⌘1, ⌘2) are left out of the layout: shadcn shows them, but nothing handles the keys.
See Sidebar.
Sidebar accessibility
Section titled “Sidebar accessibility”- A group with a label is a group named by it (
role="group",aria-labelledby), so a screen reader says “Platform, group” when the focus moves into it; shadcn’s label is plain text. - The current page’s menu button has
aria-current="page"(aria-current="true"for a button), which a screen reader says; shadcn sets onlydata-active. The skins stylearia-current, and in Windows’ high-contrast mode the current entry keeps an outline, as its background is gone there. - A menu badge describes its button (
aria-describedby), so a screen reader says “Inbox, link, 12 unread” when Tab reaches the link; shadcn’s badge is only read when reading through the list.labelgives the words to say. - The group and menu actions need an
aria-label(shadcn’s examples put a visually hidden<span>in them). A menu action is 24 px at every width, and a group action on a phone, WCAG 2.2’s minimum target size, instead of 20 px with a larger invisible hit area. - Collapsed to icons, a menu button’s tooltip repeats its name, so it is hidden from screen readers and describes
nothing (
sl:tooltip’smode="label"); Radix’s tooltip makes it the button’s description, which a screen reader says after the same name. The tooltip shows on keyboard focus too, after the delay on hover. - Collapsed to icons, a menu button’s tooltip and its dropdown menu are never shown together.
- Collapsed to icons, a click on a collapsible group’s icon expands the sidebar and opens the group; shadcn’s opens the group, whose sub-menu the strip hides. A group that holds the current page shows it on its icon, which shadcn’s does not. A collapsible item takes no badge or action (the browser hides them with the sub-menu).
Not in the sidebar yet
Section titled “Not in the sidebar yet”SidebarInput (use <sl:input>), SidebarMenuSkeleton (use <sl:skeleton>), SidebarRail, sidebar-06’s
sub-menus that open as dropdown menus while collapsed to icons, and sidebar-11’s file tree of collapsible items nested
to any depth. See Sidebar.
Sidebar layouts
Section titled “Sidebar layouts”The layouts follow shadcn’s sidebar blocks:
| Layout | shadcn/ui block |
|---|---|
| Grouped by section | sidebar-01 |
| Collapsible sections | sidebar-02 |
| Sub-menus | sidebar-03 |
| Floating, with sub-menus | sidebar-04 |
| Collapsible sub-menus | sidebar-05, with the turning chevron instead of plus and minus |
| Collapses to icons | sidebar-07 |
| Inset with secondary navigation | sidebar-08 |
| On the end | sidebar-14 |
sidebar-16’s layout (a header across the whole page, the sidebar below it) is not supported: the sidebar is sticky at
the top of the screen, so <sl:sidebar-provider> has to start at the top of the page. See
Site header for the header placement there is instead.
Theme toggle
Section titled “Theme toggle”shadcn’s dark mode is next-themes: a ThemeProvider around the app and a ModeToggle you copy from the docs. Shadleaf
has the theme script in the layout’s <head> (the provider’s part: the dark class before the first paint) and
<sl:theme-toggle/>, the same menu with Light, Dark and System.
- Its items are checked by the current choice (
menuitemradios; shadcn’s are plain items). as="button"is the one-button switch of shadcn’s own site.- The choice is stored under
localStorage['shadleaf-theme'](next-themes usestheme), and System removes it. - There is no
useTheme(): thesl-theme-changeevent tells a script about a change. - shadcn’s own site toggles the theme with the D key; Shadleaf has no shortcut, but your application can add one that clicks the toggle.
See Theme toggle.
Components shadcn/ui does not have
Section titled “Components shadcn/ui does not have”Date picker
Section titled “Date picker”shadcn has no date picker component: its docs compose a Popover, a Button and a Calendar, and the app’s own
state updates the button and closes the popover. <sl:date-picker> is that composition as one component; its
attributes go to the calendar inside.
<!-- shadcn: <Popover><PopoverTrigger asChild><Button variant="outline">{date ? format(date, "PPP") : "Pick a date"} </Button></PopoverTrigger><PopoverContent className="w-auto p-0" align="start"> <Calendar mode="single" selected={date} onSelect={setDate}/></PopoverContent></Popover> --><sl:date-picker th:field="*{dueDate}"/>
<!-- shadcn: the same with <Calendar mode="range" numberOfMonths={2} .../> --><sl:date-picker aria-label="Stay" number-of-months="2"> <sl:input type="date" th:field="*{checkIn}" aria-label="Check-in"/> <sl:input type="date" th:field="*{checkOut}" aria-label="Check-out"/></sl:date-picker>- The button’s text is formatted in the page’s locale, by
format(Intl‘sdateStyle:longis close to date-fns’PPP), not by a date-fns pattern. A range shows both ends with–between them. - A pick closes the popover: for a range, the second pick.
- It needs JavaScript; without it the popover holds the bare date inputs.
- The typed-input, time, natural language and presets demos have no counterpart yet.
Month view
Section titled “Month view”shadcn’s Calendar shows content per day through react-day-picker’s components={{DayButton}}, and full-month
calendars are blocks built on top of it. <sl:month-view> is a component of its own for that: rendered on the
server, no picking, a day slot per day and a link per day.
<!-- shadcn: <Calendar components={{DayButton: ({children, modifiers, day, ...props}) => <CalendarDayButton day={day} modifiers={modifiers} {...props}>{children}<span>{events[day.date]}</span></CalendarDayButton>}}/> --><sl:month-view day-href="/agenda/{date}"> <sl:slot name="day"><span th:text="${events[slDay.date]}"></span></sl:slot></sl:month-view>The previous and next month are links to the server (?month=2026-09), not client state. See
Month view.
File upload
Section titled “File upload”shadcn/ui has no file upload; its file upload card is an outlined Empty with a “Browse Files” button that does
nothing yet. <sl:file-upload> is Shadleaf’s own, built from that look: a visually hidden file input that the form
submits, bound with th:field to a MultipartFile or List<MultipartFile>, a Browse button (<sl:button as="label">
for the input), and with JavaScript a drop zone and a list of <sl:attachment>s, one per file, with a remove button.
<!-- shadcn: <Empty className="border"><EmptyHeader>...<EmptyTitle>Upload files</EmptyTitle> <EmptyDescription>PNG, JPG, PDF up to 10MB</EmptyDescription></EmptyHeader> <EmptyContent><Button>Browse Files</Button></EmptyContent></Empty> --><sl:file-upload th:field="*{attachments}" multiple accept="image/png,image/jpeg,application/pdf" max-size="10MB"> <sl:slot name="description">PNG, JPG, PDF up to 10 MB</sl:slot></sl:file-upload>See File Upload.
Site header and the header placement
Section titled “Site header and the header placement”shadcn/ui has no site header component: sidebar-16 and the dashboard write theirs in each block. <sl:site-header> is
that header (a header row, with an end slot for what goes to the end), and serves as the sidebar-07 page header
inside <sl:sidebar-inset> too.
shadcn/ui’s sidebar has no header placement either: placement="header" on <sl:sidebar> makes the same element a
row of links in the site header from 768 px (Flux’s header layout) and the panel on a phone, and panel-only on a
header, footer, group or menu item leaves it out of everything but the phone panel. The Layouts section has the
layouts there are, from Sub-menus on.
See Sidebar and Site Header.
User menu
Section titled “User menu”shadcn’s NavUser is part of its sidebar blocks, with the user passed in as props and a Log out item that does
nothing. <sl:user-menu> is a component: the user comes from Spring Security (#slUser), Sign out posts a form with
the CSRF token, and an anonymous visitor gets a Sign in link.
placement="header"gives the picture-only button for a site header.- The avatar stays round in the menu, where
NavUsermakes it a rounded square. - The menu’s items are what you put inside the component (shadcn’s “Upgrade to Pro”, “Account”, “Billing” and “Notifications” are the block’s own).
The team switcher and the version switcher stay examples on the Sidebar page, as in shadcn’s docs: see Menus in the sidebar.
Skip link
Section titled “Skip link”shadcn/ui has no skip link; <sl:skip-link> goes first in the body and skips to <sl:sidebar-inset>, which therefore
renders id="main" and tabindex="-1" (shadcn’s SidebarInset is a bare main). See
Skip Link.
Contrast
Section titled “Contrast”A few of shadcn’s colour pairs are under the 4.5:1 contrast WCAG asks for small text:
- destructive text on its light red tint (the destructive button and badge, the destructive alert);
- muted text on a muted background (the kbd, the avatar’s initials).
Shadleaf mixes 20% of --foreground into the text colour in those places. It still follows your own --destructive
and --muted-foreground, so your theme keeps working.
Where shadcn changes text to --muted-foreground on hover, Shadleaf keeps --foreground, for the same reason.