Design system: toast, pickers, calendar, carousel and charts
The page language ships with the shadcn look, and this lesson covers its larger components: the ones that pop up, pick a value, slide, resize or draw. All of them work without a line of JavaScript from you, the keyboard works as the reader expects, and every example below is live, so click and type in the previews.
Toast
toaster (Persian: اعلان ها)
A toast is a small message that appears in a corner, stays a few seconds and goes away by itself. Put one toaster on the page: it holds the toasts and brings their styles and script. Then give any button a toast attribute, and pressing it shows that message. toast description adds a second line and toast variant picks the colour and icon.
page:
title = "Toast"
toaster:
placement = "bottom right"
end
box:
layout = "row"
gap = 8
padding = 16
wrap = true
button:
variant = "outline"
toast = "Event created"
content = "Default"
end
button:
variant = "outline"
toast = "Saved"
toast description = "Your changes are stored."
toast variant = "success"
content = "Success"
end
button:
variant = "outline"
toast = "Upload failed"
toast description = "Check the connection and try again."
toast variant = "error"
content = "Error"
end
button:
variant = "outline"
toast = "Low disk space"
toast variant = "warning"
content = "Warning"
end
button:
variant = "outline"
toast = "A new version is out"
toast variant = "info"
content = "Info"
end
end
endA toast stops its timer while the pointer or the focus is on it, and the reader can swipe it sideways or use the close button to dismiss it.
| Where | Attribute | Values |
|---|---|---|
toaster | placementجانمایی | top left, top center, top right, bottom left, bottom center, bottom right (default). |
toaster | duration, limit, close button | Milliseconds before it goes (4000), how many show at once (3), and whether each toast has a close button. |
button | toast, toast description | The message and the second line. |
button | toast variant | default, success, error, warning, info. |
From your own script the same thing is a function: salamToast(title, {description, variant, duration, action, closeButton, id}), with the shortcuts salamToast.success, .error, .warning and .info, and salamToast.dismiss(id) to close one early.
Command, combobox and select
command (Persian: فرمان)
A command palette is a search box with a list under it that filters as the reader types. Build it from command input (ورودی فرمان), command list (فهرست فرمان), command group (گروه فرمان), with a heading, command item (گزینه فرمان), command shortcut (میانبر فرمان), command separator (جداکننده فرمان) and command empty (خالی فرمان), which shows when nothing matches. An item has a value, extra search words in keywords, and can be disabled. The arrow keys, Home and End move, Enter or a click activates, and the item fires a ds-select event whose detail.value is its value.
page:
title = "Command"
box:
padding = 16
max width = 380
command:
command input:
placeholder = "Type a command or search..."
end
command list:
command empty:
content = "No results found."
end
command group:
heading = "Suggestions"
command item:
value = "calendar"
keywords = "date schedule"
content = "Calendar"
end
command item:
value = "search"
content = "Search emoji"
end
command item:
value = "calculator"
disabled = true
content = "Calculator"
end
end
command separator:
end
command group:
heading = "Settings"
command item:
value = "profile"
content = "Profile"
command shortcut:
content = "Ctrl P"
end
end
command item:
value = "billing"
content = "Billing"
command shortcut:
content = "Ctrl B"
end
end
end
end
end
end
endType "date" and the Calendar item stays: its keywords match even though the visible text does not.
command dialog (Persian: پنجره فرمان)
The usual place for a palette is a modal. command dialog wraps a command in one. Open it from any button with opens and the dialog's id, or let the reader press a key: hotkey = "k" opens it with Ctrl or Cmd plus K.
page:
title = "Command dialog"
box:
padding = 16
button:
variant = "outline"
opens = "palette"
content = "Open the palette (Ctrl K)"
end
end
command dialog:
id = "palette"
hotkey = "k"
command:
command input:
placeholder = "Type a command..."
end
command list:
command empty:
content = "No results found."
end
command group:
heading = "Go to"
command item:
value = "home"
content = "Home"
end
command item:
value = "docs"
content = "Documentation"
end
command item:
value = "settings"
content = "Settings"
end
end
end
end
end
endcombobox (Persian: جعبه ترکیبی)
A combobox is a field that opens a searchable list. Its items are combobox item (گزینه جعبه ترکیبی) elements. The chosen item shows a check mark, and choosing it again clears the value. With a name the value travels in a hidden input, so a form sends it. The second box below is clearable and starts with a value.
page:
title = "Combobox"
box:
layout = "row"
gap = 12
padding = 16
min height = 280
combobox:
name = "framework"
placeholder = "Select framework..."
search placeholder = "Search framework..."
empty text = "No framework found."
combobox item:
value = "next"
content = "Next.js"
end
combobox item:
value = "svelte"
content = "SvelteKit"
end
combobox item:
value = "nuxt"
content = "Nuxt"
end
combobox item:
value = "remix"
disabled = true
content = "Remix"
end
end
combobox:
name = "city"
value = "oslo"
clearable = true
placeholder = "Pick a city"
combobox item:
value = "oslo"
content = "Oslo"
end
combobox item:
value = "lima"
content = "Lima"
end
combobox item:
value = "kyoto"
content = "Kyoto"
end
end
end
end| Attribute | Meaning |
|---|---|
name, value | The form field name and the starting value. |
placeholder, search placeholder, empty text | Text of the closed box, of the search field and of the "nothing found" line. |
clearable, disabled | Show a clear button; turn the control off. |
ds-change | The event fired when the value changes. |
select box (Persian: جعبه انتخاب)
A select box is a custom list box that replaces the browser's select where you want the look to match. It is made of a select trigger (دکمه جعبه انتخاب) whose content is the placeholder, and a select content (محتوای جعبه انتخاب) with select item (گزینه جعبه انتخاب), select group (گروه جعبه انتخاب) and select separator (جداکننده جعبه انتخاب). The trigger's size is default or sm. The keyboard works: arrows, Home and End, Enter or Space, Escape, and typing the start of a word.
page:
title = "Select box"
box:
layout = "row"
gap = 12
padding = 16
min height = 300
select box:
name = "fruit"
select trigger:
content = "Select a fruit"
end
select content:
select group:
heading = "Fruits"
select item:
value = "apple"
content = "Apple"
end
select item:
value = "banana"
content = "Banana"
end
select item:
value = "kiwi"
disabled = true
content = "Kiwi"
end
end
select separator:
end
select group:
heading = "Vegetables"
select item:
value = "carrot"
content = "Carrot"
end
select item:
value = "pea"
content = "Pea"
end
end
end
end
select box:
name = "size"
value = "m"
select trigger:
size = "sm"
content = "Size"
end
select content:
select item:
value = "s"
content = "Small"
end
select item:
value = "m"
content = "Medium"
end
select item:
value = "l"
content = "Large"
end
end
end
select box:
disabled = true
select trigger:
content = "Disabled"
end
select content:
select item:
value = "x"
content = "X"
end
end
end
end
endLike the combobox, it keeps its value in a hidden input when it has a name, and fires ds-change.
Calendar and date picker
calendar (Persian: تقویم)
A month grid with previous and next buttons, today marked, and full keyboard support: arrows move by a day or a week, Home and End go to the ends of the week, PageUp and PageDown change the month, and Shift with them changes the year. Values are always written as ISO Gregorian dates, 2026-11-18, whichever calendar is shown. A range is from/to, such as 2026-11-10/2026-11-16.
page:
title = "Calendar modes"
box:
layout = "row"
gap = 16
padding = 16
wrap = true
calendar:
mode = "single"
value = "2026-11-18"
end
calendar:
mode = "range"
value = "2026-11-10/2026-11-16"
end
calendar:
min = "2026-11-05"
max = "2026-11-25"
week start = 1
disabled days = "0,6"
disabled dates = "2026-11-12,2026-11-13"
end
end
endThe first calendar picks one day, the second a range, and the third shows the limits: min and max grey out days outside, week start chooses the first column, disabled days lists weekday numbers to block (0 is Sunday, so "0,6" blocks the weekend) and disabled dates lists single days.
| Attribute | Values |
|---|---|
calendarتقویم | gregorian (default), jalali. |
modeشیوه انتخاب | single (default), range, multiple. |
value, min, max | ISO dates; for a range, from/to; for multiple, a comma list. |
week start | 0 to 6, Sunday is 0. The default is 6 (Saturday) for Jalali. |
disabled days, disabled dates | Weekday numbers such as "0,6"; an ISO list. |
ds-change | Event with detail.value, or detail.from and detail.to for a range; detail.dates lists every picked day. |
With mode = "multiple" every click toggles a day, so a reader can pick any set of days; the value is the comma list in order, such as 2026-11-18,2026-11-20. In a date picker the popover stays open while days are picked and the button shows how many are chosen.
page:
title = "Calendar, several dates"
box:
layout = "row"
gap = 16
padding = 16
min height = 420
wrap = true
calendar:
mode = "multiple"
value = "2026-11-18,2026-11-20"
end
calendar:
calendar = "jalali"
mode = "multiple"
value = "2026-03-21,2026-03-25"
end
date picker:
name = "days"
mode = "multiple"
placeholder = "Pick some days"
end
end
endThe Jalali calendar
Write calendar = "jalali" and the grid becomes the Persian calendar: months such as Aban, a year like 1405, a week that starts on Saturday and a right to left layout. On an English page the month and weekday names and the digits are English, as in the previews here, and on a Persian page the same calendar shows Persian names and digits. The conversion is plain arithmetic inside the page, the same rules as the calendar package of the standard library, so it does not depend on the browser having Persian calendar data and the month names are always the ones above. Only what the reader sees changes: the value you read and write stays an ISO Gregorian date, so the rest of your code never converts anything.
page:
title = "Jalali calendar"
box:
layout = "row"
gap = 16
padding = 16
wrap = true
calendar:
calendar = "jalali"
value = "2026-11-18"
end
calendar:
calendar = "jalali"
mode = "range"
value = "2026-11-10/2026-11-16"
end
end
enddate picker (Persian: انتخابگر تاریخ)
A date picker is a button that opens a calendar in a popover. It takes every attribute of the calendar, plus name, placeholder and disabled, and a hidden input holds the ISO value for a form. The three below are a single date, a range and a Jalali date with a starting value.
page:
title = "Date picker"
box:
layout = "row"
gap = 12
padding = 16
min height = 380
date picker:
name = "birthday"
placeholder = "Pick a date"
end
date picker:
name = "trip"
mode = "range"
placeholder = "Pick a range"
end
date picker:
name = "when"
calendar = "jalali"
value = "2026-11-18"
end
end
endCarousel, resizable and sidebar
carousel (Persian: چرخفلک)
A carousel shows one slide at a time and scrolls between them with snapping. It is made of a carousel content (محتوای چرخفلک) that holds the slides, each a carousel item (اسلاید), and optional carousel previous (قبلی چرخفلک) and carousel next (بعدی چرخفلک) buttons, which sit outside the slides and are disabled at the ends unless loop is on. The arrow keys, Home and End, and dragging with the mouse all work. dots adds the row of position dots.
page:
title = "Carousel"
box:
padding = 56
max width = 420
carousel:
dots = true
loop = true
carousel content:
carousel item:
box:
height = 140
border = 1, "solid", "#a1a1aa"
radius = 8
align = "center"
paragraph:
content = "Slide 1"
end
end
end
carousel item:
box:
height = 140
border = 1, "solid", "#a1a1aa"
radius = 8
align = "center"
paragraph:
content = "Slide 2"
end
end
end
carousel item:
box:
height = 140
border = 1, "solid", "#a1a1aa"
radius = 8
align = "center"
paragraph:
content = "Slide 3"
end
end
end
end
carousel previous:
end
carousel next:
end
end
end
endA vertical carousel needs a fixed height on its content. This one also has autoplay, in milliseconds, which pauses while the pointer or focus is on it.
page:
title = "Vertical carousel"
box:
padding = 16
max width = 300
carousel:
orientation = "vertical"
autoplay = 3000
carousel content:
height = 130
carousel item:
paragraph:
content = "First: the slides move up and down."
end
end
carousel item:
paragraph:
content = "Second: autoplay pauses on hover."
end
end
carousel item:
paragraph:
content = "Third: arrow keys also work."
end
end
end
carousel previous:
end
carousel next:
end
end
end
end| Attribute | Values |
|---|---|
orientationراستا | horizontal (default), vertical. |
loop, dots | Wrap around at the ends; show the dots. |
autoplay | Milliseconds between slides; unset means no autoplay. |
From script, salamDsCarousel.go(el, index) jumps to a slide.
resizable (Persian: قابل تغییر)
A resizable group lays out panels side by side (or one above the other) with draggable handles between them. The panels are resizable panel (بخش قابل تغییر), the handles resizable handle (دستگیره قابل تغییر). A panel's size is a percentage; panels without one share what is left, and min size and max size keep it in bounds. A handle moves with the mouse or with the arrow keys (5 percent a step), Home and End. grip = true draws the little grip. Groups nest, as the vertical one inside the right panel does here. Every change fires ds-resize with detail.sizes.
page:
title = "Resizable"
box:
padding = 16
resizable:
height = 260
border = 1, "solid", "#a1a1aa"
radius = 8
resizable panel:
size = 30
min size = 15
box:
padding = 16
paragraph:
content = "Sidebar"
end
end
end
resizable handle:
grip = true
end
resizable panel:
resizable:
orientation = "vertical"
resizable panel:
size = 40
box:
padding = 16
paragraph:
content = "Top"
end
end
end
resizable handle:
grip = true
end
resizable panel:
max size = 80
box:
padding = 16
paragraph:
content = "Bottom"
end
end
end
end
end
end
end
endsidebar (Persian: پنل نوار کناری)
The word sidebar is already another name for aside, so the shadcn side panel is called sidebar panel. It lives in a sidebar provider (فراهم کننده نوار کناری) with the main area in sidebar inset (محتوای اصلی نوار کناری). Inside the panel you use sidebar header (سرایند نوار کناری), sidebar content (محتوای نوار کناری), sidebar footer (پاورقی نوار کناری), sidebar group (گروه نوار کناری) with sidebar group label and sidebar group content, sidebar menu (منوی نوار کناری), sidebar menu item (آیتم منوی نوار کناری), sidebar menu button (دکمه منوی نوار کناری), sidebar menu badge (نشان منوی نوار کناری) and sidebar separator (جداکننده نوار کناری). sidebar trigger (دکمه نوار کناری) is the toggle button, and Ctrl or Cmd plus B does the same.
page:
title = "Sidebar"
sidebar provider:
height = 340
sidebar panel:
collapsible = "icon"
sidebar header:
paragraph:
content = "Acme Inc"
end
end
sidebar content:
sidebar group:
sidebar group label:
content = "Application"
end
sidebar group content:
sidebar menu:
sidebar menu item:
sidebar menu button:
active = true
url = "#home"
content = "Home"
end
end
sidebar menu item:
sidebar menu button:
url = "#inbox"
content = "Inbox"
end
sidebar menu badge:
content = "12"
end
end
sidebar menu item:
sidebar menu button:
variant = "outline"
size = "sm"
url = "#search"
content = "Search"
end
end
end
end
end
end
sidebar separator:
end
sidebar footer:
paragraph:
content = "Ali Rezaei"
end
end
end
sidebar inset:
box:
padding = 12
sidebar trigger:
end
paragraph:
content = "Press the button, or Ctrl B, to collapse the panel."
end
end
end
end
endThe preview needs a window wider than 768 pixels to show the panel. Below that width the panel becomes a sheet that slides over the page, opened by the trigger.
Three more parts finish the sidebar. sidebar rail (لبه نوار کناری) is the thin strip on the panel edge that toggles it; put it directly inside the sidebar panel. sidebar menu sub (زیرمنوی نوار کناری), sidebar menu sub item (آیتم زیرمنوی نوار کناری) and sidebar menu sub button (دکمه زیرمنوی نوار کناری) nest a list under a menu item: the item's own menu button gets a chevron and opens and closes the list. When an icon panel is collapsed, hovering or focusing a menu button shows a tooltip beside the icon.
page:
title = "Sidebar parts"
sidebar provider:
height = 260
sidebar panel:
collapsible = "icon"
sidebar rail:
end
sidebar content:
sidebar group:
sidebar group content:
sidebar menu:
sidebar menu item:
sidebar menu button:
active = true
tooltip = "Back to the start"
svg:
content = "<circle cx='8' cy='8' r='6' fill='currentColor'/>"
end
content = "Home"
end
end
sidebar menu item:
open = true
sidebar menu button:
svg:
content = "<rect x='2' y='2' width='12' height='12' rx='3' fill='currentColor'/>"
end
content = "Projects"
end
sidebar menu sub:
sidebar menu sub item:
sidebar menu sub button:
active = true
url = "#alpha"
content = "Alpha"
end
end
sidebar menu sub item:
sidebar menu sub button:
size = "sm"
url = "#beta"
content = "Beta"
end
end
end
end
end
end
end
end
end
sidebar inset:
box:
padding = 12
sidebar trigger:
end
paragraph:
content = "Collapse the panel, then hover an icon for its tooltip. The thin strip on the panel edge toggles it too."
end
end
end
end
end| Element | Attribute | Values |
|---|---|---|
sidebar panel | side | left (default), right. |
sidebar panel | variant | sidebar (default), floating, inset. |
sidebar panel | collapsible | offcanvas, icon (shrinks to icons), none. |
sidebar provider | collapsed, hotkey | Start collapsed; "false" turns the Ctrl or Cmd plus B key off. The state is in data-state, and ds-change fires. |
sidebar menu button | active, url | Marks the current page; with url the button is a link. |
sidebar menu button | variant, size | default or outline; default, sm or lg. |
sidebar menu button | tooltip | Text of the tooltip shown beside the icon when the icon panel is collapsed; without it the button text is used. |
sidebar menu item | open | For an item that holds a sidebar menu sub: start it expanded. |
sidebar menu sub button | active, size, url | Like the menu button; size is sm or md (default). |
Charts
chart (Persian: نمودار)
A chart is drawn in the browser as SVG, redraws when the window resizes and shows a tooltip on hover. The data lives in the page: a chart series (سری نمودار) is one data set with a label and an optional tint colour, and each chart point (نقطه نمودار) has a label and a value. Points are matched to categories by position, and the first series names the categories. Without a tint the series take the theme colours var(--chart-1) to var(--chart-5) in order. The attribute type (نوع) picks the kind.
| Attribute | Meaning |
|---|---|
type | bar, line, area, pie, donut. |
chart height | Height in pixels, 250 by default. |
legend, label | Show the legend; give the chart an accessible name. |
grid | "false" hides the grid lines. |
stacked | Stack the series, for bar and area. |
center | The caption under the total in the middle of a donut. |
Bar
One group of bars per category, one bar per series.
page:
title = "Bar chart"
box:
padding = 16
max width = 560
chart:
type = "bar"
label = "Visitors per month"
legend = true
chart series:
label = "Desktop"
chart point:
label = "Jan"
value = "186"
end
chart point:
label = "Feb"
value = "305"
end
chart point:
label = "Mar"
value = "237"
end
chart point:
label = "Apr"
value = "173"
end
end
chart series:
label = "Mobile"
chart point:
label = "Jan"
value = "80"
end
chart point:
label = "Feb"
value = "200"
end
chart point:
label = "Mar"
value = "120"
end
chart point:
label = "Apr"
value = "190"
end
end
end
end
endLine and area
The line chart plots one series. The area chart fills under the line; with stacked the second series sits on top of the first, and grid = "false" removes the grid lines.
page:
title = "Line and area charts"
box:
layout = "row"
gap = 16
padding = 16
wrap = true
box:
width = 320
chart:
type = "line"
chart height = 200
label = "Line chart"
chart series:
label = "Revenue"
chart point:
label = "Jan"
value = "120"
end
chart point:
label = "Feb"
value = "180"
end
chart point:
label = "Mar"
value = "150"
end
chart point:
label = "Apr"
value = "260"
end
end
end
end
box:
width = 320
chart:
type = "area"
chart height = 200
stacked = true
legend = true
grid = "false"
label = "Stacked area chart"
chart series:
label = "Web"
chart point:
label = "Jan"
value = "120"
end
chart point:
label = "Feb"
value = "180"
end
chart point:
label = "Mar"
value = "150"
end
chart point:
label = "Apr"
value = "260"
end
end
chart series:
label = "App"
tint = "var(--chart-3)"
chart point:
label = "Jan"
value = "60"
end
chart point:
label = "Feb"
value = "90"
end
chart point:
label = "Mar"
value = "110"
end
chart point:
label = "Apr"
value = "80"
end
end
end
end
end
endPie and donut
Pie and donut charts use only the first series, and each point is a slice. A point can have its own tint, as the third slice does. The donut shows the total in the middle with the center text under it.
page:
title = "Pie and donut charts"
box:
layout = "row"
gap = 16
padding = 16
wrap = true
box:
width = 260
chart:
type = "pie"
chart height = 220
legend = true
label = "Browsers"
chart series:
chart point:
label = "Chrome"
value = "275"
end
chart point:
label = "Safari"
value = "200"
end
chart point:
label = "Firefox"
value = "120"
tint = "#7c3aed"
end
end
end
end
box:
width = 260
chart:
type = "donut"
chart height = 220
legend = true
center = "Visitors"
label = "Browsers"
chart series:
chart point:
label = "Chrome"
value = "275"
end
chart point:
label = "Safari"
value = "200"
end
chart point:
label = "Firefox"
value = "120"
tint = "#7c3aed"
end
end
end
end
end
end