Skip to content
Nana UI

Button

View .md Download

A clickable button (or link styled as a button) with variants, sizes, loading and icon support.

Save changes
Terminal window
npm install @nana-tec/ui-components
import "@nana-tec/ui-components/button";
<nana-button variant="primary">Save changes</nana-button>
Primary Secondary Tertiary Danger Success Ghost Link
XS SM MD LG XL
Default Disabled Loading

Properties

PropertyAttributeTypeDefaultDescription
activebooleanfalsePressed / current state (visual only — not a variant).
ariaLabelaria-labelstring | nullnull
asButtonAs'button'Polymorphic host element. `href` implies `a` automatically.
disabledbooleanfalse
formstring | undefined
fullWidthfull-widthbooleanfalse
hrefstring | undefined
iconOnlyicon-onlybooleanfalse
loadingbooleanfalse
loadingTextloading-textstring | undefined
namestring | undefined
relstring | undefined
rounded'none' | 'sm' | 'md' | 'lg' | 'full''md'
shapeButtonShape'default'Layout shape (radius system). Overrides `rounded` when not `default`.
sizeSize'md'
target'_blank' | '_self' | '_parent' | '_top' | undefined
type'button' | 'submit' | 'reset''button'
valuestring | undefined
variantButtonVariant'primary'

Events

EventDescription
nana-click

Slots

SlotDescription
(default)Button label
prefixContent before the label (e.g. a leading icon)
suffixContent after the label (e.g. a trailing icon)

CSS parts

PartDescription
::part(base)The underlying `<button>` or `<a>` element
::part(loader)The spinner shown while `loading`

CSS custom properties

PropertyDescription
--nana-button-bgBackground colour (hover derives from it automatically)
--nana-button-colorText colour
--nana-button-radiusCorner radius (overrides the `rounded` attribute)
EventTypeDescription
nana-clickCustomEvent
SlotDescription
(default)Button label
prefixContent before the label (e.g. a leading icon)
suffixContent after the label (e.g. a trailing icon)
VariableDefaultDescription
--nana-button-bgBackground colour (hover derives from it automatically)
--nana-button-colorText colour
--nana-button-radiusCorner radius (overrides the rounded attribute)
PartDescription
baseThe underlying <button> or <a> element
loaderThe spinner shown while loading
  • Keyboard accessible
  • Screen-reader labels
  • Focus-visible states
  • ARIA roles and states
  • WCAG 2.2 AA contrast
Explore Button interactively Every state, prop, and edge case — with live controls — in Storybook.
View in Storybook