Button
A standalone action primitive with native semantics, Signal inputs, typed output, loading feedback and complete visual ownership.
GET STARTED
Import
Import from the granular entry point so unused components stay out of the application bundle.
FOUNDATION
Basic action
Use a literal or bound label for everyday actions; projected content remains available for rich composition. The modern clicked output emits the native MouseEvent.
Semantic severities
Intent is explicit and shared with the rest of NeuralNg's semantic palette.
Visual variants
Outlined and text change the treatment, raised composes with either treatment, and rounded switches to the shared pill radius. If both text and outlined are present, text takes precedence deterministically.
Icons and sizing
The icon input removes repetitive inner markup. Logical start/end placement follows RTL, and icon-only actions still need an accessible name. With no label or projected content, the styled control automatically keeps equal width and height at every size.
Disabled and loading
Loading replaces the visible label, exposes aria-busy and prevents duplicate activation.
Badge composition
Use logical inline positions for counts or corner positions for notification-style indicators.
Native form semantics
The default type is safely button. Opt into native submit or reset behavior explicitly.
Unstyled + Tailwind
Remove NeuralNg's visual layer while keeping the real button, disabled/loading behavior and structural hook. buttonClass targets the native element.
AI-FIRST CONTRACT
Readable by humans. Deterministic for agents.
The package ships focused README and llms.txt context beside the entry point, including imports, modern Signal APIs, accessibility rules and failure modes.
BUTTON
Accessibility
Native semantics and predictable assistive technology behavior are part of the Button contract.
Accessibility
Native first
A real button preserves Enter, Space, focus and form behavior.
Busy state
Loading exposes aria-busy and an accessible loading label.
Icon actions
ariaLabel names actions whose visible content is only an icon.
Logical badges
Start and end positions automatically follow writing direction.
BUTTON
API
The complete typed input and output contract for the standalone Button component.
API
Inputs
| Name | Type | Default | Description |
|---|---|---|---|
| type | 'button' | 'submit' | 'reset' | 'button' | Native button type. |
| severity | NeuralButtonSeverity | 'neutral' | Semantic visual intent. |
| disabled | boolean | false | Disables native interaction. |
| loading | boolean | false | Displays progress and blocks activation. |
| loadingLabel | string | 'Loading' | Visible and accessible busy label. |
| ariaLabel | string | null | null | Accessible name for icon-only actions. |
| ariaExpanded | 'true' | 'false' | null | null | Disclosure state. |
| ariaControls | string | null | null | Controlled surface ID. |
| ariaKeyShortcuts | string | null | null | Composite-control shortcuts. |
| title | string | '' | Supplementary native title. |
| label | string | null | null | Visible label; projection remains the fallback. |
| icon | string | null | null | Icon class string, such as nt nt-check. |
| iconPosition | 'start' | 'end' | 'start' | Logical icon position around the label. |
| size | 'small' | 'medium' | 'large' | 'medium' | Preset control size. |
| iconSize | 'small' | 'medium' | 'large' | null | null | Icon size override; null follows the control size. |
| outlined | boolean | false | Uses a transparent bordered treatment. |
| raised | boolean | false | Adds elevation to any visual variant. |
| text | boolean | false | Uses a borderless text treatment. |
| rounded | boolean | false | Uses the pill-shaped radius token. |
| buttonClass | string | '' | Classes applied to the native button. |
| unstyled | boolean | false | Removes NeuralNg visual classes. |
| badge | string | number | null | null | Inline or floating badge value. |
| badgePosition | NeuralButtonBadgePosition | 'end' | Inline or corner position. |
| badgeSeverity | NeuralBadgeSeverity | 'neutral' | Badge semantic color. |
| badgeSize | NeuralBadgeSize | 'small' | Badge size. |
| badgeMax | number | null | null | Maximum count before + formatting. |
| badgeAriaLabel | string | null | null | Accessible badge description. |
| badgeClass | string | '' | Consumer classes for the badge. |
Output
clickedMouseEventEmitted after an allowed native click.
Composite components can also consume keyDown, pointerDown, pointerMove, pointerUp and pointerCancel without falling back to a raw button.
BUTTON
Design tokens
Tune the styled Button layer without changing its behavior or markup contract.
Design tokens
Override component tokens locally, at a product boundary or through your global design system.
--neural-button-paddingComponent internal spacing.
--neural-button-gapSpacing between component items.
--neural-button-radiusComponent corner radius.
--neural-button-rounded-radiusRounded corner radius.
--neural-button-group-radiusGroup corner radius.
--neural-button-font-sizeComponent font size.
--neural-button-font-weightComponent font weight.
--neural-button-backgroundComponent background surface.
--neural-button-background-hoverHovered component background surface.
--neural-button-colorComponent foreground color.
--neural-button-border-colorComponent border color.
--neural-button-shadowComponent box shadow.
--neural-button-shadow-hoverHovered component box shadow.
--neural-button-raised-shadowRaised box shadow.
--neural-button-raised-shadow-hoverHovered raised box shadow.
--neural-button-focus-ringComponent keyboard focus ring.
--neural-button-disabled-opacityDisabled opacity.
--neural-button-transitionComponent CSS transition.