Tinyrack

Button

Buttons for commands and form actions, with six intents, three appearances, and three sizes.

Contract

AxisValuesDefaultUse
intentneutral, primary, info, success, warning, dangerneutralCommunicates the purpose or outcome of an action.
appearancesolid, outline, ghostsolidChanges visual emphasis without changing intent.
uiSizemd, lgmdMatches the size of surrounding controls.
disabledbooleanfalsePrevents the action.
loadingbooleanfalsePrevents the action and communicates that it is in progress.

Install

pnpm add @tinyrack/ui

Scroll inside the code area to read long lines.

Styles

@import '@tinyrack/ui/components/button.css';

Scroll inside the code area to read long lines.

Imports

import { TRButton } from '@tinyrack/ui/components/button';

Scroll inside the code area to read long lines.

Playground

Usage

Basic action permalink

Use the primary intent for the main action. TRButton renders a native button by default.

Examples

Solid intents permalink

Use solid buttons for actions that need the strongest emphasis.

Outline intents permalink

Use outline buttons for actions that should remain visible with less emphasis.

Ghost intents permalink

Use ghost buttons for low-emphasis actions on uncluttered surfaces.

Sizes permalink

Choose a size that matches nearby controls, not the importance of the action.

States permalink

Use disabled when an action is unavailable and loading while it is in progress.

API

Tinyrack props

PropTypeDefaultPurpose
intentneutral | primary | info | success | warning | dangerneutralSelects the action's semantic meaning and color role.
appearancesolid | outline | ghostsolidSelects visual emphasis without changing the intent.
uiSizemd | lgmdSelects the button size.
loadingbooleanfalsePrevents activation and exposes an in-progress state.
loadingLabelstringnoneSets the accessible name while loading.
variantsecondary | primary | dangersecondaryDeprecated compatibility prop; use intent in new code.

HTML element and inherited props

TRButtonProps extends Base UI Button props.

Inherited propDefaultBehavior
disabledfalsePrevents activation.
focusableWhenDisabledfalseKeeps a disabled button in the focus order when set to true.
rendernoneComposes button behavior and styling onto another element or component.
nativeButtontrueIndicates whether the rendered element is a native <button>.
typebutton for native buttonsSelects native button, submit, or reset behavior.

Native button attributes, React event handlers, state-aware className and style, and the React 19 ref are also supported.

By default, TRButton renders an HTML <button> with type="button". Set type="submit" or type="reset" intentionally inside a form. When render uses an element other than <button>, set nativeButton={false} so Base UI can provide button behavior without adding the native type attribute. This keeps button semantics; use TRLink for navigation.

Loading and accessible name

When loading is true, TRButton prevents activation, prepends an aria-hidden spinner, and sets aria-busy="true". Without loadingLabel, the existing accessible name stays unchanged. When loadingLabel is provided, it becomes the temporary accessible name and replaces aria-labelledby while loading. When loading is false, an explicit aria-busy value is preserved.

Legacy variant

The deprecated variant prop remains for compatibility. secondary maps to neutral; primary and danger map to the intents with the same names. An explicit intent takes precedence over variant.