Skip to content

Button

Tactile native actions with clear variants. CSS only

Button
Copy this markup
<button class="ui-button" type="button">Publish component</button>

Install

Styles and registration
import '@timelessui/components/css/tokens.css'
import '@timelessui/components/css/button.css'

Attributes

Every value below is implemented by the stylesheets this component ships. Boolean attributes are presence-based: author the attribute with no value, or omit it.

AttributeValuesDefaultDescription
data-ui-variantprimary · secondary · outline · ghost · danger · danger-outline · linkprimaryVisual intent. Use primary for the main action in a view, secondary for neutral actions, outline when the action needs a stronger edge, ghost for low-emphasis toolbar actions, danger and danger-outline for destructive actions, and link for an action that should read as inline text.
data-ui-sizesm · md · lgmdControl height, padding, and font size.

State

Native attributes, ARIA, and platform pseudo-classes are authoritative. Style state through the selectors below rather than adding your own state classes.

StateSourceHow to express it
disablednativeNative disabled, or aria-disabled on an anchor.

Styling

Root identity: ui-button. Required stylesheets: tokens.css, button.css.

Set these custom properties to restyle the component:

Custom propertyControls
--ui-button-bgResting background.
--ui-button-bg-hoverHover background.
--ui-button-bg-activeActive background.
--ui-button-fgLabel color.
--ui-button-fg-hoverHover label color.
--ui-button-borderBorder color.
--ui-button-shadowResting shadow.
--ui-button-shadow-hoverHover shadow.
--ui-button-shadow-activeActive shadow.
--ui-button-heightMinimum block size.
--ui-button-padding-xInline padding.
--ui-button-gapGap between icon and label.
--ui-button-radiusCorner radius.
Design tokens this component reads (20)

These are global Atmosphere tokens. Change them once at the theme level rather than per component.

--ui-accent · --ui-bg-accent · --ui-bg-accent-active · --ui-bg-accent-hover · --ui-bg-control · --ui-bg-control-active · --ui-bg-control-hover · --ui-bg-control-muted · --ui-bg-danger · --ui-bg-danger-active · --ui-bg-danger-hover · --ui-duration-fast · --ui-ease-standard · --ui-fg · --ui-focus · --ui-radius-control · --ui-shadow-control-accent · --ui-shadow-control-active · --ui-shadow-control-danger · --ui-shadow-outline-control

Accessibility

Keep the native elements, roles, and relationships shown in the example. Timeless adds only the state and keyboard coordination the platform does not already provide, and it never supplies your accessible names — those depend on your content.

Before JavaScript runs

This primitive is CSS only. There is nothing to register and nothing to wait for.

More examples

Open Button in StoryLite for variants, controls, and manual testing.