{ "$schema": "../../schema/schema.json", "id": "button", "version": "2.2.0", "displayName": "Button", "description": "Triggers an action or event. The primary interactive element in the system.", "status": "stable", "platforms": ["web", "ios", "android"], "tokens": { "color": { "background.primary": "brand.500", "background.primary.hover": "brand.600", "background.primary.active": "brand.700", "background.secondary": "transparent", "background.ghost": "transparent", "background.destructive": "feedback.error.default", "background.destructive.hover": "error.600", "text.primary": "neutral.0", "text.secondary": "brand.500", "text.ghost": "brand.500", "text.destructive": "neutral.0", "border.secondary": "brand.500", "border.destructive": "feedback.error.default", "focus.ring": "focus.default" }, "typography": { "label.size": "textSize.sm", "label.weight": "weight.semibold", "label.tracking": "tracking.wide" }, "spacing": { "padding.x.sm": "space.sm", "padding.x.md": "space.md", "padding.x.lg": "space.lg", "padding.y.sm": "space.xs", "padding.y.md": "space.sm", "padding.y.lg": "space.md", "icon.gap": "space.xs" }, "border": { "radius": "radius.md", "width": "border.width.sm" }, "motion": { "transition": "duration.fast" } }, "props": { "variant": { "type": "enum", "description": "Visual style of the button.", "values": ["primary", "secondary", "ghost", "destructive"], "default": "primary", "tokenMapped": true }, "size": { "type": "enum", "description": "Controls padding and label size.", "values": ["sm", "md", "lg"], "default": "md", "tokenMapped": true }, "label": { "type": "string", "description": "Visible button text.", "required": true }, "disabled": { "type": "boolean", "default": false }, "loading": { "type": "boolean", "default": false }, "iconStart": { "type": "ref", "ref": "icon" }, "iconEnd": { "type": "ref", "ref": "icon" }, "iconOnly": { "type": "boolean", "default": false }, "fullWidth": { "type": "boolean", "default": false }, "onPress": { "type": "function", "required": true }, "href": { "type": "string" }, "type": { "type": "enum", "values": ["button", "submit", "reset"], "default": "button" } }, "states": ["default", "hover", "focus", "active", "disabled", "loading"], "variants": [ { "id": "primary-default", "props": { "variant": "primary", "label": "Continue" } }, { "id": "secondary-default", "props": { "variant": "secondary", "label": "Cancel" } }, { "id": "ghost-default", "props": { "variant": "ghost", "label": "More options" } }, { "id": "destructive", "props": { "variant": "destructive", "label": "Delete" } }, { "id": "icon-only", "props": { "variant": "ghost", "iconOnly": true, "label": "Close" } }, { "id": "loading", "props": { "variant": "primary", "loading": true, "label": "Saving" } } ], "composition": { "slots": { "trigger": { "description": "The button's interactive surface.", "required": true, "childOrder": ["iconStart", "label", "iconEnd"], "children": { "iconStart": { "type": "icon", "figma": { "visible": false, "booleanProp": "iconStart" } }, "label": { "type": "text", "figma": { "textProp": "label" } }, "iconEnd": { "type": "icon", "figma": { "visible": false, "booleanProp": "iconEnd" } } } } }, "forbiddenParents": ["button"] }, "behavior": { "focusable": true, "pressable": true, "keyboardShortcuts": [ { "key": "Enter", "action": "Activate button" }, { "key": "Space", "action": "Activate button" } ] }, "accessibility": { "role": "button", "labelSource": "prop", "wcagLevel": "AA" }, "usage": { "do": [ "Use one primary button per section or modal", "Keep labels short and action-oriented", "Use loading state to prevent duplicate submissions" ], "dont": [ "Don't use more than one primary button in a single context", "Don't use for navigation — use a Link instead", "Don't nest buttons inside other interactive elements" ] }, "platformNotes": { "ios": "Use ButtonStyle protocol for variant theming. Loading state should use ProgressView overlay.", "android": "Implement as Material3 Button with custom ColorScheme. Use CircularProgressIndicator for loading." }, "changelog": [ { "version": "2.2.0", "date": "2026-03-21", "changes": ["Added slot composition with childOrder", "Added figma rendering hints to slot children", "Added explicit destructive tokens", "Added hover and active state tokens for primary variant"] }, { "version": "2.0.0", "date": "2025-01-15", "changes": ["BREAKING: Renamed 'danger' variant to 'destructive'", "Added loading prop", "Added iconStart/iconEnd props"] }, { "version": "1.0.0", "date": "2024-04-10", "changes": ["Initial stable release"] } ] }