Components
Components
Every component, grouped by what it is for: forms, actions, navigation, overlays, feedback, layout, data, typography and chat. Each is a set of CSS classes, plus a small behaviour where one is needed.
61 components in 9 groups. Jump to one:
Forms & inputs#
Controls that take input and submit with a form, and the fields that label them.
Checkbox
A box that toggles between checked and not checked, with sizes, states and every field feature.
Combobox
An input with a filtered list of suggestions: groups, multiple picks as chips, a clear button, server search.
Field
Labels, help text and messages for controls; inline, responsive and grid forms.
Input
Text inputs, textareas, selects and file pickers with every state.
Input group
Icons, text, buttons, menus and spinners inside an input's border.
Input OTP
A one-time code or PIN in a row of slots: 4-digit authenticator codes, digits or letters, groups, paste and SMS autofill, sizes and states.
Label
An accessible label for any control, wrapping checkboxes and radios, or as a choice card.
Password input
A password field with a show / hide toggle: eye icon or text, a checkbox, Caps Lock warning, every input state.
Radio group
Radio buttons as cards or inline rows: one choice of a few, submitting with the form.
Select
A list of options in a popup opened from a button: searchable, keyboard driven, styled like an input.
Slider
Pick a value, a range or several values on a track: native range inputs, vertical too, with every form state.
Switch
An on/off setting that applies at once: a sliding track on a real checkbox, no JavaScript.
Textarea
Multi-line text that grows as you type: field, character count, every state, and Ctrl/⌘+Enter to submit.
Actions & menus#
Buttons, toggles and menus that do something.
Button
Actions in every variant, size and state, including loading.
Button group
Join buttons, inputs and menus: split buttons, toolbars, vertical groups.
Clipboard
Copy buttons and copy tags that work on every browser: icon, label or both, a green tick when copied, every button variant and size.
Command
A command menu for search and quick actions: filtering, keyboard, groups, shortcuts, inline or in a ⌘K dialog.
Dropdown
A menu of links, actions and options that opens from a button, with checkbox and radio items, shortcuts and submenus.
Menubar
A persistent row of menus, as in desktop apps: submenus, checkbox and radio items, icons and shortcuts.
Scroll button
A floating button that jumps back to the bottom or top of a container or the page.
Toggle
A two-state button, on or off, in any button style.
Toggle group
A set of toggle buttons: pick one, at most one, or many.
Navigation#
Moving between pages and between views of a page.
Breadcrumb
The path to the current page: custom separators, dropdowns, and collapsing to an ellipsis when space runs out.
Navigation menu
A site's main navigation: links, and buttons that open panels of links, from simple lists to mega menus.
Pagination
Links to the pages of a long list, with previous and next, page numbers or icons only.
Sidebar
Composable app navigation: groups, menus, badges and actions, collapsing to icons or off-canvas, with a mobile panel.
Tabs
Layered panels shown one at a time: line, pill and outline styles, icons, disabled tabs, vertical, synced and remembered.
Overlays#
Content that opens above the page: modals, panels, popups and hints.
Alert dialog
A modal that interrupts with important content and waits for an answer: small size, media and destructive actions.
Dialog
A modal window over the page or another dialog: close button or outside click, scrolling content, sticky footer, htmx fragments.
Drawer
A panel on an edge of the screen that can be swiped away: four directions, a handle, nested drawers, a responsive dialog.
Hover card
A card that previews what is behind a link when a mouse rests on it or the link gets keyboard focus.
Popover
A floating panel of rich content that opens from a button: a header, alignment, and forms.
Sheet
A dialog that slides in from an edge of the screen: four sides, sizes, scrolling content, htmx fragments.
Tooltip
A short hint on hover or keyboard focus, on any side, with no JavaScript needed to show it.
Feedback & status#
Messages, progress, loading and empty states, and labels for status.
Alert
Callouts for info, success, warnings and errors.
Badge
Small status labels and counters.
Empty
An empty state with an icon, a message and a way forward.
Loader
Pure-CSS loading indicators: dots, waves, pulses and animated text.
Progress
A bar showing how far a task has got, with an optional label, value and help text.
Skeleton
Placeholders shaped like loading content: any shape, text, avatars, cards, lists, tables and forms.
Spinner
Loading indicator from any icon or pure CSS; works in buttons, badges and inputs.
Toast
Stacking, swipeable notifications: success, info, warning, error and loading, actions, promises and server toasts.
Layout & disclosure#
Containers that group, separate, reveal or scroll through content.
Accordion
Stacked headings that reveal sections; one or many open, no JavaScript.
Card
Header, content and footer, with media, an action slot and scrolling content.
Carousel
Slides that drag, swipe and snap with momentum (Embla): item sizes, spacing, vertical, options and plugins.
Collapsible
A button that shows and hides a panel: extra settings, nested file trees, or <details> with no JavaScript.
Separator
A horizontal or vertical line between content, semantic or purely visual.
Data display#
Rows, tables and people: structured content to scan.
Avatar
An image with a fallback for a user: sizes, status badges, groups with a count, and menu triggers.
Item
A row of content with media, a title, a description and actions, alone or in a list.
Table
Readable data tables with optional hover rows.
Timeline
Events in chronological order: dots, icons or avatars, colours, sizes, vertical or horizontal, alternating sides.
Typography & media#
Long-form text, code, keys and icons.
Code block
Highlighted source with a copy button and package-manager tabs.
Icon
SVG icons inlined at build time, or linked as images.
Kbd
Keyboard keys and shortcuts, on their own or in buttons, tooltips and input groups.
Text
Long-form content with .prose (Tailwind Typography), plus helpers for single elements.
Chat & AI#
Conversations, attachments and assistant replies.
Attachment
A file, image, video or audio attachment with upload states, sizes, orientation and scrolling groups.
Chain of thought
A sequence of steps on a connecting line, each folding its details away: reasoning traces, tool calls and process logs.
Message
A chat message with avatar, header, footer and alignment; groups, attachments, and reasoning and tool calls for AI chat.
Message scroller
Scrolling for a streaming chat transcript: new questions rise to the top, replies grow beneath them, and the view moves only when the reader does.
Prompt input
The text box of an AI chat: a growing textarea, tools, send and stop, @ mentions and / commands.
Reasoning
A collapsible for AI reasoning that opens while it streams and closes, with its duration, when it ends.
Anatomy of a component#
Each component has its own directory, htmx-ui/components/<name>/ (packages/ui/src/components/<name>/ in the repository), holding:
<name>.css: classes in@layer components, built from token utilities with@apply.<name>.ts(optional): aninit<Name>(root)function that wires up[data-<name>]elements once each, with<name>.test.tsbeside it.<name>.html(optional): a Nunjucks macro for markup that is tedious to write by hand.