Skip to Content
DocsFrontend DevelopmentOther ComponentsCommon Components

common — Generic UI widgets

Plain visual widgets with no model awareness. Drop-in usable from anywhere — pages, layouts, dialogs, view components. Inputs are simple data (strings, numbers, callbacks); none of them know about modelName, MetaModel, or FilterCondition.

For the broader taxonomy (where common/ sits among the five layers), see Index.

FileExportCategory
pagination-bar.tsxPaginationBarPagination
empty-state.tsxEmptyStateEmpty / loading
loading-skeleton.tsxLoadingSkeletonEmpty / loading
full-screen-loading.tsxFullScreenLoading (default export)Empty / loading
status-badge.tsxStatusBadgeStatus / identity
user-avatar.tsxUserAvatarStatus / identity
timeline.tsxTimelineDisplay
check-list.tsxCheckListDisplay
safe-html.tsxSafeHtml, sanitizeHtmlDisplay (stored HTML)
sandboxed-html-frame.tsxSandboxedHtmlFrameDisplay (stored HTML)
date-picker.tsxDatePickerInput
datetime-picker.tsxDateTimePickerInput
time-picker.tsxTimePickerInput
time-column-panel.tsxTimeColumnPanelInput (building block)
time-utils.tsresolveTimeConfig, typesUtility
option-select.tsxOptionSelectInput
density-switcher.tsxDensitySwitcherApp control

Imports: import { PaginationBar } from "@/components/common/pagination-bar";


Pagination

PaginationBar

Standalone pagination row (page nav buttons + size dropdown + record count). Used by ModelTable / ModelCard toolbars, but also usable in custom lists.

<PaginationBar pageNumber={page} totalPages={totalPages} pageSize={pageSize} totalCount={totalCount} selectedCount={selectedIds.length} onPageChange={setPage} onPageSizeChange={setPageSize} />
PropTypeRequiredDefaultNotes
pageNumbernumberYes-1-based current page
totalPagesnumberYes-Total page count (clamped to ≥ 1 in display)
pageSizenumberYes-Current rows per page
onPageChange(n: number) => voidYes-Receives 1-based new page
onPageSizeChange(n: number) => voidYes-New page size value
totalCountnumberNo-Shown as Total N records; omitted hides summary
selectedCountnumberNo0Appended as · Selected N when > 0
availablePageSizesnumber[]No[10,20,50,100]Dropdown options
classNamestringNo-

Empty / loading

EmptyState

Centered “no data / no result” placeholder. Defaults to a database icon when icon is omitted.

<EmptyState title="No deployments yet" description="Pick an environment to see deployments." action={<Button>Get started</Button>} /> // compact variant — for inline empty states inside cards/panels <EmptyState compact title="No items" />
PropTypeRequiredDefaultNotes
titlestringYes-Primary text
descriptionstringNo-Secondary explanation (max-width: max-w-sm)
iconReactNodeNo<Database>Custom icon
actionReactNodeNo-Button or link below the text
compactbooleanNofalseSmaller paddings / fonts; for inline use
classNamestringNo-

LoadingSkeleton

Pre-baked full-page skeleton (input row + body + pagination footer placeholders). Use for pages that are about to render a Model* view but haven’t loaded data yet.

if (isLoading) return <LoadingSkeleton />;

No props.

FullScreenLoading

Modal full-screen overlay with a spinner. Default export. Use for blocking operations that span the whole app.

import FullScreenLoading from "@/components/common/full-screen-loading"; {isSaving && <FullScreenLoading />}

No props.


Status / identity

StatusBadge

Colored pill badge backed by class-variance-authority variants. Doesn’t look up status meaning — caller picks the variant.

<StatusBadge variant="success">Active</StatusBadge> <StatusBadge variant="warning">Pending</StatusBadge> <StatusBadge variant="error">Failed</StatusBadge> <StatusBadge variant="info">Draft</StatusBadge> <StatusBadge variant="neutral">Archived</StatusBadge>
PropTypeRequiredDefaultNotes
variant"success" | "warning" | "error" | "info" | "neutral"No"neutral"Color theme
classNamestringNo-Merged with variant classes
…HTMLSpanAttributes---Forwarded to underlying <span>

UserAvatar

Avatar circle. Renders a photo if photoUrl loads; otherwise falls back to a User icon. The photoUrl host doesn’t need to be in next.config.js’s remotePatterns (uses plain <img>).

<UserAvatar photoUrl={user.avatarUrl} /> <UserAvatar /> {/* fallback icon */} <UserAvatar className="h-12 w-12" /> {/* custom size */}
PropTypeRequiredDefaultNotes
photoUrlstringNo-Avatar URL; auto-fallback on load error
classNamestringNoh-(--ds-h-xl) w-(--ds-h-xl)Override size with Tailwind classes

Display

Timeline

Vertical event timeline with a connecting border. The first event is highlighted; later events render in muted color.

<Timeline events={[ { idField: "evt-1", timeField: "2026-04-30 09:30", userField: "Alice Lee", actionField: "submitted the request", detailsField: "Reason: vacation", }, { idField: "evt-2", timeField: "2026-04-30 10:15", userField: "Bob Manager", actionField: "approved the request", }, ]} />
PropTypeRequiredDefaultNotes
eventsTimelineEvent[]Yes-Empty list renders nothing
classNamestringNo-

TimelineEvent shape (each field already holds a formatted display value):

FieldTypeNotes
idFieldstringUsed as React key; typically the event record id
timeFieldstringPre-formatted timestamp text
userFieldstringActor name
actionFieldstringVerb phrase, e.g. "approved the request"
detailsFieldstring?Optional secondary line

CheckList

Vertical checklist. Checked items show a green check + line-through; unchecked show an outlined circle.

<CheckList items={[ { idField: "1", labelField: "Submit form", statusField: true }, { idField: "2", labelField: "Wait for approval", statusField: false, descriptionField: "Manager review pending" }, ]} />
PropTypeRequiredDefaultNotes
itemsCheckListItem[]Yes-Empty list renders nothing
classNamestringNo-

CheckListItem shape:

FieldTypeNotes
idFieldstringReact key
labelFieldstringItem label
statusFieldbooleantrue = checked (line-through, green); false = unchecked
descriptionFieldstring?Optional secondary line

Stored HTML

An HTML string from the server reaches the page through one of these two components and nowhere else. Lint rejects dangerouslySetInnerHTML, a dynamic innerHTML / outerHTML assignment and insertAdjacentHTML in the rest of src/ (project/html-sink-guard in eslint.config.mjs), so a new screen cannot skip them by accident. The editors only produce formatting, but not everything in an HTML field came through an editor: a received email is stored verbatim, and the API accepts whatever a caller writes.

Which one depends on what the HTML is:

The HTML isUseWhy
Content of the page — rich text or a template written in this applicationSafeHtmlIt should read as part of the page, in the page’s typography
A document in its own right, written elsewhere — an email bodySandboxedHtmlFrameSanitizing keeps script out, but only a frame keeps a foreign document’s styles and layout off the application
A summary of either, in a table cell or tooltiphtmlToPlainText (@/utils/html-text)A one-line cell cannot hold markup; show the text

A plain value going into HTML you are assembling (a label, a name) is neither: escape it with escapeHtml (@/utils/html-text).

SafeHtml

A <div> whose content is an HTML string, sanitized with DOMPurify. html is the string as stored; every other prop (className, ref, onClick, …) goes to the <div>.

<SafeHtml className="tiptap-content" html={record.description} />

What survives: formatting markup, class / style / data-* attributes (template placeholders are data-tpl-*), tables, data: image sources, and links — target="_blank" is kept and always paired with rel="noopener noreferrer". What does not: anything that can run script (<script>, on* handlers, javascript: URLs, frames, SVG / MathML), <style> (a stylesheet in a field value would restyle the whole application), and form controls. sanitizeHtml(html) is the same rule as a function, for the rare caller that needs the string.

Three behaviours to know:

  • The content cannot leave its box. Sanitizing decides what the content may be, not where it may be drawn: style and class survive, so stored content could otherwise place itself over the whole page — with position: fixed, or with the application’s own overlay classes, which no attribute filter can tell from formatting. The wrapper therefore carries contain: layout paint (it is the containing block of everything inside, fixed-position included, and clips to its box) and overflow: auto, so content that is legitimately wider than the box, such as a table, scrolls instead of being cut off. A caller’s style cannot switch the containment off. Something drawn just outside an element at the box’s edge — a focus ring — is clipped too; give the wrapper a little padding where that matters.
  • The injected markup stays put while html is unchanged. React rebuilds injected HTML whenever the object carrying it changes identity; SafeHtml keeps it stable, so a page can attach clicks to nodes inside (signature slots, template placeholders) and re-render freely without losing an interaction that lands mid-render.
  • Nothing is rendered on the server. There is no DOM to sanitize with there, and markup in a server response is parsed by the browser before client code runs. The content is filled in on the client — on first render, or right after hydration when the page was server-rendered with it.

SandboxedHtmlFrame

An <iframe sandbox="" srcDoc> for an HTML document that is not ours. The empty sandbox grants nothing: no script, no forms, no navigating the application, and an origin of its own, so the document reads no cookies or storage and its styles stay inside the frame.

<SandboxedHtmlFrame title="Mail body" html={record.bodyHtml} className="h-64 rounded-md border" />
PropTypeRequiredNotes
htmlstringYesShown as-is; not sanitized, because nothing in it can act
titlestringYesThe frame’s accessible name
classNamestringNoHeight and border. The frame cannot report its content height to the page — that needs access the sandbox withholds — so the caller sizes it and the document scrolls inside

A link clicked inside loads within the frame, under the same sandbox, and one that asks for a new tab does nothing. Remote images still load, so a sender can tell a message was opened. Forms use it through the HtmlFrame field widget.

Input

All three pickers (DatePicker / DateTimePicker / TimePicker) share the same shape: string in, string out. The trigger label can be rendered in a different display format (e.g. 12-hour or locale-specific) via displayFormat, but the machine value always uses the canonical machine format so downstream pipelines (form values, FilterCondition, backend contract) never need to know about display mode.

The triggerWrapper prop lets a form adapter inject <FormControl>{button}</FormControl> so react-hook-form’s a11y wiring (id / aria-describedby / aria-invalid) reaches the trigger button. Standalone callers omit it and the button is the trigger directly.

IME key presses and onKeyDown

Input and Textarea (components/ui/) do not call onKeyDown for a key press that belongs to an input method.

While a CJK user is composing, the keys go to the IME — Enter confirms the candidate, arrows move through the list, Escape cancels — yet the browser still fires keydown for each. A handler reading key === "Enter" as “submit” then sends a half-composed chat message, adds the pinyin as a tag, or closes a rename field mid-word. So an onKeyDown passed to Input / Textarea needs no check of its own, and should not add one.

A handler on anything else — a raw <input>, a wrapper element that catches keys bubbling up from a text box — calls isImeKeyEvent(event) from @/utils/ime and returns early when it is true. That is isComposing, plus key code 229 on Enter: Safari reports the composition as already over on the confirming Enter, and only the key code still says IME. (229 is checked on Enter alone because Android soft keyboards report it for ordinary typing.)

DatePicker

Calendar-only date picker.

<DatePicker value={value} onChange={setValue} /> <DatePicker value={value} onChange={setValue} dateFormat="yyyy-MM" />
PropTypeRequiredDefaultNotes
valuestringYes-Date string in dateFormat; "" = no selection
onChange(next: string) => voidYes-New value; "" when cleared
dateFormatstringNoconfigs.dateTimeFormats.date (yyyy-MM-dd)Machine format. Pass "yyyy-MM" / "MM-dd" for partial-date pickers
displayFormatstringNo= dateFormatTrigger-label format
disabledbooleanNofalse
placeholderstringNo"Pick a date"
classNamestringNo-Applied to trigger button
triggerWrapper(button) => ReactElementNo-Form adapter wraps with <FormControl>
triggerStyleCSSPropertiesNo-Inline style on trigger button

DateTimePicker

Calendar + 24h time-column panel side-by-side. Footer hosts Clear / Now / Apply.

<DateTimePicker value={value} onChange={setValue} /> <DateTimePicker value={value} onChange={setValue} defaultTime="23:59:59" />

Machine format is fixed at yyyy-MM-dd HH:mm:ss (matches configs.dateTimeFormats.dateTime).

PropTypeRequiredDefaultNotes
valuestringYes-yyyy-MM-dd HH:mm:ss; "" = no selection
onChange(next: string) => voidYes-
displayFormatstringNoconfigs.dateTimeFormats.dateTimeTrigger-label format. Pass e.g. "yyyy-MM-dd hh:mm:ss a" for 12-hour
defaultTimestringNo"00:00:00"Time-of-day to seed when the user picks a date but value has no time yet. Range filter end-points pass "23:59:59"
disabledbooleanNofalse
placeholderstringNo"Pick date & time"
classNamestringNo-
triggerWrapper(button) => ReactElementNo-
triggerStyleCSSPropertiesNo-

TimePicker

Time-only picker (no calendar). Renders TimeColumnPanel inside a popover.

<TimePicker value={value} onChange={setValue} timeFormat="HH:mm:ss" /> <TimePicker value={value} onChange={setValue} timeFormat="HH:mm" config={resolveTimeConfig({ min: "08:00", max: "18:00", minuteStep: 15 }, "HH:mm")} />
PropTypeRequiredDefaultNotes
valuestringYes-24h ISO string in timeFormat; "" = no selection
onChange(next: string) => voidYes-
timeFormat"HH:mm" | "HH:mm:ss"Yes-Machine format; the panel’s columns always render 24h
displayFormatstringNo= timeFormatdate-fns format for the trigger label (e.g. "hh:mm:ss a" for 12h)
configResolvedTimeConfigNoresolveTimeConfig(undefined, timeFormat)Bounds / quick-options
disabledbooleanNofalse
placeholderstringNo"Pick time"
classNamestringNo-
triggerWrapper(button) => ReactElementNo-
triggerStyleCSSPropertiesNo-

TimeColumnPanel

The bare scrollable HH / mm / (ss) column panel that powers TimePicker and DateTimePicker. Use directly only when you need the columns embedded in custom layout. Footer (Clear / Now / Apply) is conditional on onClear / onApply / config.clearable / config.showQuickPick.

resolveTimeConfig

Pure resolver (no widget knowledge) for TimePicker / TimeColumnPanel config. Takes Partial<TimePickerConfig> and a TimeFormat, returns ResolvedTimeConfig with bounds parsed, step values validated, and defaultTime snapped to the step grid.

import { resolveTimeConfig } from "@/components/common/time-utils"; const config = resolveTimeConfig( { min: "08:00", max: "18:00", minuteStep: 15, quickOptions: ["09:00", "12:00"] }, "HH:mm", );

TimePickerConfig shape:

FieldTypeNotes
min / maxstringInclusive bounds in timeFormat
minuteStep / secondStepnumberOne of [1,2,3,4,5,6,10,12,15,20,30,60] (divisors of 60); 60 means only 00; invalid values warn and fall back to 1
defaultTimestringPre-fill on first open; auto-snapped UP to step grid
quickOptionsstring[]Quick-pick buttons rendered above the columns; out-of-range / off-grid entries auto-disable
clearablebooleanShow Clear in footer (default true)
showQuickPickbooleanShow Now in footer (default true)

OptionSelect

Standalone select bound to an option set (server-defined enum). Handles loading / error states internally.

<OptionSelect optionSetCode="DocumentStatus" value={status} onChange={setStatus} filters={[["disabled", "=", false]]} // optional client-side prune placeholder="Pick a status" />
PropTypeRequiredDefaultNotes
optionSetCodestringYes-Identifier of the option set on the server
valuestring | numberNo-Currently selected itemCode
onChange(value: string | undefined) => voidNo-New itemCode (or undefined when cleared)
placeholderstringNo"Please select..."
disabledbooleanNofalse
readOnlybooleanNofalseVisually displays without interactivity, full contrast
filtersFilterConditionNo-Client-side filter applied to fetched options
classNamestringNo-

When loading → renders a Skeleton. On error → renders a disabled select with "Failed to load options".


App control

DensitySwitcher

Toggles compact / comfortable UI density via useDensity() from @/providers/density-provider. Used in the app Header. No props besides className.

<DensitySwitcher />
PropTypeRequiredDefaultNotes
classNamestringNo-

Adding a new common widget

A widget belongs in common/ if all are true:

  • It takes plain data (no modelName / MetaModel / FilterCondition props)
  • It does not depend on Model* view containers (SidePanelContainerProvider etc.)
  • It can be used outside of a Model* host (in dialogs, layouts, custom pages)
Last updated on