Back to Airi

`@proj-airi/ui` Component Reference

docs/ai/context/ui-components.md

0.10.117.9 KB
Original Source

@proj-airi/ui Component Reference

Auto-maintained: When adding or updating components in packages/ui, update this document accordingly.

Standardized primitives built on reka-ui. Minimal business logic — use these instead of raw DOM elements.

Source: packages/ui/src/components/


Animations

TransitionBidirectional

Bidirectional Vue <Transition> wrapper with customizable CSS classes.

PropTypeDefaultDescription
fromClassstring?CSS class for initial state
activeClassstring?CSS class during transition
toClassstring?CSS class for final state

Slots: default

TransitionHorizontal

Horizontal slide/fade transition (0.5s hardcoded).

Props: None | Slots: default

TransitionVertical

Smooth vertical expand/collapse with height animation and opacity control.

PropTypeDefaultDescription
durationnumber?250Animation duration (ms)
easingEnterstring?'ease-in-out'Enter easing function
easingLeavestring?'ease-in-out'Leave easing function
opacityClosednumber?0Opacity when closed
opacityOpenednumber?1Opacity when opened

Slots: default


Layout

Collapsible

Expandable/collapsible container with trigger button and vertical animation.

PropTypeDefaultDescription
defaultboolean?Initial visibility
labelstring?Trigger button label

v-model: visible: boolean Slots: trigger({ visible, setVisible }), default({ visible, setVisible })

Screen

Responsive screen component that calculates canvas dimensions based on breakpoints.

Props: None | Slots: default({ width, height })

Skeleton

Loading placeholder with animation.

PropTypeDefaultDescription
animation'pulse' | 'wave' | 'none''pulse'Animation style

Slots: default

Truncatable

Line-clamped content container that expands and collapses when the overflowing content area is clicked.

PropTypeDefaultDescription
lineClampnumber?3Maximum visible lines while collapsed

Slots: default


Misc

Button

Versatile button with variants, sizes, and states.

PropTypeDefaultDescription
toggledboolean?falseToggle state
iconstring?UnoCSS/Iconify icon class
labelstring?Button text
disabledboolean?falseDisabled state
loadingboolean?falseLoading state
variant'primary' | 'secondary' | 'secondary-muted' | 'danger' | 'caution' | 'pure' | 'ghost''primary'Visual variant
size'sm' | 'md' | 'lg''md'Size
shape'rounded' | 'pill' | 'square''pill'Shape
blockboolean?falseFull width

Slots: default (fallback when no label)

Callout

Alert/callout box with themed accent bar.

PropTypeDefaultDescription
theme'primary' | 'violet' | 'lime' | 'orange''primary'Color theme
labelstring?Title

Slots: label, default

ContainerError

Error display with copy/feedback buttons and scrollable stack trace.

PropTypeDefaultDescription
errorunknown?Error object
messagestring?Custom message
stackstring?Stack trace
includeStackboolean?trueShow stack
showCopyButtonboolean?trueShow copy button
showFeedbackButtonboolean?trueShow feedback button
copyButtonLabelstring?'Copy'Copy button text
copiedButtonLabelstring?'Copied'Copied state text
feedbackButtonLabelstring?'Feedback'Feedback button text
heightPreset'sm' | 'md' | 'lg' | 'xl' | 'auto''md'Container height

Emits: copy(content: string), feedback()

ErrorBoundary

Catches synchronous render/setup errors in descendants via onErrorCaptured and renders a fallback (built-in ContainerError + retry button) instead of letting the error propagate. Use to wrap <RouterView> or any subtree where partial failure should not blank the host layout. Async/unhandled rejections are NOT captured — use app.config.errorHandler for those.

PropTypeDefaultDescription
titlestring?Optional title shown above error details
retryableboolean?trueShow built-in retry button
retryLabelstring?'Try again'Retry button label

Slots: default, fallback({ error, info, retry }) Emits: error(err, instance, info), retry() Exposed: retry(), hasError()

DoubleCheckButton

Two-stage confirmation button — click once to reveal confirm/cancel.

PropTypeDefaultDescription
variantButtonVariant'danger'Confirm button variant
cancelVariantButtonVariant'secondary'Cancel button variant
size'sm' | 'md' | 'lg''md'Size
blockboolean?falseFull width
disabledboolean?falseDisabled
loadingboolean?falseLoading

Emits: confirm(), cancel() Slots: default (initial text), confirm (confirm text), cancel (cancel text)

Progress

Linear progress bar with animated shine.

PropTypeDefaultDescription
progressnumber(required)Percentage 0–100
barClassstring?Custom bar color class

Form — Input

Input

Basic text/number input.

PropTypeDefaultDescription
typeInputType?HTML input type
variant'primary' | 'secondary' | 'primary-dimmed''primary'Visual variant
size'sm' | 'md' | 'lg''md'Size

v-model: modelValue: string | number

BasicInputFile

Low-level file input with drag-drop support.

PropTypeDefaultDescription
acceptstring?Accepted MIME types
multipleboolean?Allow multiple files
isDraggingClassesstring | string[]?Classes when dragging
isNotDraggingClassesstring | string[]?Classes when not dragging

v-model: modelValue: File[] Slots: default({ isDragging, firstFile, files })

InputFile

File input with preview and drag-drop UI.

PropTypeDefaultDescription
acceptstring?Accepted file types
multipleboolean?Allow multiple
placeholderstring?'Choose file'Placeholder text

v-model: modelValue: File[] | undefined

InputFileCard

Styled file upload card with drag-and-drop zone.

PropTypeDefaultDescription
acceptstring?Accepted file types
multipleboolean?Allow multiple

v-model: inherits from BasicInputFile Slots: default (custom upload UI)

InputKeyValue

Two-column input for key-value pairs.

PropTypeDefaultDescription
namestring?Input name attribute
keyPlaceholderstring?Key placeholder
valuePlaceholderstring?Value placeholder

v-model: propertyKey: string, propertyValue: string


Form — Textarea

BasicTextarea

Auto-resizing textarea with submit and paste-file events.

PropTypeDefaultDescription
defaultHeightstring?Initial height when empty
submitOnEnterboolean?trueSubmit on Enter (Shift+Enter for newline)

v-model: input: string Emits: submit(message: string), pasteFile(files: File[])

Textarea

Styled textarea wrapping BasicTextarea.

v-model: modelValue: string


Form — Checkbox / Radio

Checkbox

Toggle switch using reka-ui SwitchRoot.

PropTypeDefaultDescription
disabledboolean?Disabled state

v-model: modelValue: boolean

Radio

Single radio button for radio groups.

PropTypeDefaultDescription
idstring(required)Unique ID
namestring(required)Radio group name
valuestring(required)Option value
titlestring(required)Display label
deprecatedboolean?falseDeprecation indicator

v-model: modelValue: string


Form — Range

Range

Horizontal slider with progress visualization.

PropTypeDefaultDescription
minnumber?0Minimum value
maxnumber?100Maximum value
stepnumber?1Step increment
disabledboolean?falseDisabled
thumbColorstring?'#9090906e'Thumb color
trackColorstring?'gray'Track color
trackValueColorstring?'red'Filled track color

v-model: modelValue: number

ColorHueRange

HSL hue selector (0–360) with rainbow gradient.

PropTypeDefaultDescription
disabledboolean?Disabled

v-model: modelValue: number

RoundRange

Rounded-style slider.

PropTypeDefaultDescription
minnumber?0Minimum
maxnumber?100Maximum
stepnumber?1Step
disabledboolean?falseDisabled

v-model: modelValue: number


Form — Select

Select

Dropdown select using reka-ui with grouping and custom rendering.

PropTypeDefaultDescription
optionsSelectOptionItem<T>[] | SelectOptionGroupItem<T>[](required)Options
placeholderstring?'Select an option'Placeholder
disabledboolean?falseDisabled
bystring | ((a: T, b: T) => boolean)?Custom comparison
contentMinWidthstring | number?160Dropdown min width
contentWidthstring | number?Dropdown width
shape'rounded' | 'default''default'Shape
variant'blurry' | 'default''default'Variant

v-model: modelValue: T Slots: value({ option, value, placeholder }), option({ option })

SelectOption

Individual option item within Select.

PropTypeDefaultDescription
optionSelectOptionItem<T>(required)Option data

Slots: default


Form — Combobox

Combobox

Searchable dropdown/autocomplete using reka-ui with grouping.

PropTypeDefaultDescription
optionsComboboxOptionItem<T>[] | ComboboxOptionGroupItem<T>[](required)Options
placeholderstring?Placeholder
disabledboolean?falseDisabled
contentMinWidthstring | number?Dropdown min width
contentWidthstring | number?Dropdown width

v-model: modelValue: T Slots: option({ option }), empty

ComboboxSelect

Simplified Combobox wrapper for string/number options.

PropTypeDefaultDescription
options{ label, value, description?, disabled?, icon? }[]?Options
placeholderstring?Placeholder
disabledboolean?falseDisabled
titlestring?Title
layout'horizontal' | 'vertical'?Layout direction
contentMinWidthstring | number?Dropdown min width
contentWidthstring | number?Dropdown width

v-model: modelValue: string | number Slots: option({ option }), empty

ComboboxOption

Option item within combobox (uses provide/inject).

PropTypeDefaultDescription
valuestring | number(required)Value
labelstring?Display text
activeboolean?Active state

Slots: default


Form — SelectTab

SelectTab

Tab-like selection using radio buttons with animated indicator.

PropTypeDefaultDescription
optionsSelectTabOption[](required)Tab options { label, value, description?, icon? }
disabledboolean?falseDisabled
readonlyboolean?falseRead-only
size'sm' | 'md''md'Size

v-model: modelValue: T


Form — Field (Labeled wrappers)

All Field components wrap a base input with label, description, and consistent layout. Common slots: label, description.

FieldInput

PropTypeDefaultDescription
labelstring?Label
descriptionstring?Helper text
placeholderstring?Placeholder
requiredboolean?Required indicator
typeInputType?Input type
inputClassstring?Custom input class
singleLineboolean?truetrue = input, false = textarea

v-model: modelValue: T

FieldCheckbox

PropTypeDefaultDescription
labelstring?Label
descriptionstring?Helper text
disabledboolean?Disabled
placement'left' | 'right''right'Switch position

v-model: modelValue: boolean

FieldTextArea

PropTypeDefaultDescription
labelstring?Label
descriptionstring?Helper text
placeholderstring?Placeholder
requiredboolean?Required indicator
textareaClassstring?Custom textarea class
rowsnumber?6Rows

v-model: modelValue: string

FieldRange

PropTypeDefaultDescription
minnumber?Min
maxnumber?Max
stepnumber?Step
labelstring?Label
descriptionstring?Helper text
formatValue(value: number) => string?Value formatter
as'label' | 'div''label'Wrapper element

v-model: modelValue: number

FieldInputFile

PropTypeDefaultDescription
labelstring?Label
descriptionstring?Helper text
acceptstring?Accepted types
multipleboolean?Multiple
placeholderstring?Placeholder

v-model: modelValue: File[] | undefined

FieldSelect

PropTypeDefaultDescription
labelstring(required)Label
descriptionstring?Helper text
optionsSelectOptionItem<T>[] | SelectOptionGroupItem<T>[]?Options
placeholderstring?Placeholder
disabledboolean?Disabled
layout'horizontal' | 'vertical''horizontal'Layout
bystring | ((a, b) => boolean)?Comparison
shape'rounded' | 'default'?Shape
variant'blurry' | 'default'?Variant

v-model: modelValue: T Slots: label, description, value, option

FieldCombobox

PropTypeDefaultDescription
labelstring(required)Label
descriptionstring?Helper text
options{ label, value, description?, disabled?, icon? }[]?Options
placeholderstring?Placeholder
disabledboolean?falseDisabled
layout'horizontal' | 'vertical''horizontal'Layout

v-model: modelValue: string Slots: label, description, option, empty

FieldKeyValues

Dynamic key-value pair list with add/remove.

PropTypeDefaultDescription
labelstring?Label
descriptionstring?Helper text
namestring?Input name
keyPlaceholderstring?Key placeholder
valuePlaceholderstring?Value placeholder
requiredboolean?Required
inputClassstring?Custom input class

v-model: keyValues: { key: string, value: string }[] Emits: remove(index: number), add(key: string, value: string)

FieldValues

Dynamic string list with add/remove.

PropTypeDefaultDescription
labelstring?Label
descriptionstring?Helper text
namestring?Input name
valuePlaceholderstring?Value placeholder
requiredboolean?Required
inputClassstring?Custom input class

v-model: items: string[] Emits: remove(index: number), add()


Composables

Exported from packages/ui/src/composables/:

  • useDeferredMount() — Defers component mounting (useful for heavy components).
  • useTheme() — Theme management composable.