Skip to content

components/button

import { … } from 'zidane-ui'ui/src/components/button.ts

buttonClass, size xs
buttonClass, size sm
buttonClass, size md
disabled
with icon, as a link

Functions#

buttonClassFunction#

The button look as a class string, for <button>, <a> or a router link alike.

TypeScript
function buttonClass(
  options?: { flush?: 'start' | 'end'; size?: ButtonSize; variant?: ButtonVariant },
): string
Parameters
NameTypeDefaultDescription
options?{ flush?: 'start' | 'end'; size?: ButtonSize; variant?: ButtonVariant }{}

The variant, size and flush alignment of the button. Defaults to a secondary, md button.

string

The class string for the button look.

ui/src/components/button.ts:77

Constants#

BTN_DANGERConstant#

In-row destructive action (Remove / Delete / Clear): quiet until hovered.

TypeScript
const BTN_DANGER = ...

ui/src/components/button.ts:105

BTN_DANGER_CONFIRMConstant#

Armed destructive confirm (Confirm remove / Confirm delete): the danger fill.

TypeScript
const BTN_DANGER_CONFIRM = ...

ui/src/components/button.ts:108

BTN_LG_DANGERConstant#

Destructive dialog footer action (Delete session, Deny): the danger fill.

TypeScript
const BTN_LG_DANGER = ...

ui/src/components/button.ts:120

BTN_LG_PRIMARYConstant#

Primary header action or form submit, soft accent.

TypeScript
const BTN_LG_PRIMARY = ...

ui/src/components/button.ts:114

BTN_LG_SECONDARYConstant#

Secondary header / footer action (Refresh / Cancel …): the accent button stays rightmost.

TypeScript
const BTN_LG_SECONDARY = ...

ui/src/components/button.ts:111

BTN_LG_SOLIDConstant#

The committing action of a dialog footer: accent fill.

TypeScript
const BTN_LG_SOLID = ...

ui/src/components/button.ts:117

BTN_PRIMARYConstant#

In-row primary action (Sign in / Retry / Import …): soft accent, not a slab.

TypeScript
const BTN_PRIMARY = ...

ui/src/components/button.ts:102

BTN_SECONDARYConstant#

In-row secondary action (Edit / Update / Sign out / Keep / Cancel …).

TypeScript
const BTN_SECONDARY = ...

ui/src/components/button.ts:99

Types#

ButtonVariantType#

Look of a button: secondary (raised chip), primary (soft accent wash), solid (accent fill for the committing action of a dialog), ghost (text only), danger (muted red) and danger-solid (danger fill for the destructive commit).

TypeScript
type ButtonVariant =
  | 'secondary'
  | 'primary'
  | 'solid'
  | 'ghost'
  | 'danger'
  | 'danger-solid'

ui/src/components/button.ts:60