Skip to Content
Data Attributes

Data Attributes

All interactive state in Wire UI is exposed through data-* attributes. An attribute is present as an empty string when active and absent when not — never "true" or "false".

/* Target present-when-active attributes like this: */ [data-hover] { ... } /* ✓ correct */ [data-hover="true"] { ... } /* ✗ never matches */ [data-hover="false"] { ... } /* ✗ never matches */

Universal interactive attributes

Set by useInteractiveState — available on Button and any component using the hook.

AttributeWhen present
data-hoverMouse is over the element
data-focus-visibleElement has keyboard focus (matches :focus-visible)
data-activeElement is being pressed (pointer down, or Space/Enter held)
data-disabledElement is disabled
data-autofocusElement was rendered with the autoFocus prop

Form field attributes

AttributeComponentWhen present
data-activeInput, Textarea, PasswordField is focused
data-invalidInput, Textarea, PasswordinvalidType prop is set (consumer-controlled)
data-successInput, TextareaisSuccess prop is true

State attributes

AttributeComponentValues
data-stateModal, Drawer, Accordion Item/Trigger/Content, Dropdown Menu, Tooltip Content, Switch"open" / "closed" or "checked" / "unchecked"
data-visiblePassword.TogglePresent when password is visible
data-loadingSearch.RootPresent when loading prop is true
data-highlightedSearch.ItemPresent on the keyboard-focused result item
data-completeOTP.RootPresent when all slots are filled

Variant attributes

Set by the consumer directly as HTML attributes — Wire UI passes them through.

AttributeComponentExample values
data-sizeIcon, ProgressBar, List, Spinner"small", "medium", "large"
data-statusAlert"success", "warning", "danger"
data-colorCardAny string — your design tokens
data-typeList"disc", "decimal", etc.
data-stripedListPresent attribute (no value needed)
data-dividerListPresent attribute (no value needed)
data-positionImage wrapper"left", "center", "right"
data-countBadgeRaw numeric count value
data-sideTooltip.Content"top", "bottom", "left", "right"

Media attributes

AttributeComponentWhen present
data-loadedImage <img>After a successful load event
data-statusAvatar.Image"loading", "loaded", or "error"
Last updated on

MIT License © 2026 wire-ui