charcell 0.1.0
mode

Button

a button, boxed or dense. pressing it inverts it.

usage

example

code

import { Button } from 'charcell/react';

export function ButtonExample() {
  return <Button label="kick" />;
}

as text

at rest
┌──────┐
│ kick │
└──────┘
hover
┌──────┐
│ kick │
└──────┘
press
┌──────┐
│ kick │
└──────┘
focus
┌──────┐
│❯kick │
└──────┘

props

labelstring
The button's text, ahead of anything in the default slot.
variant'boxed' | 'dense'= 'boxed'
boxed draws the ring around the label; dense is one bare 16px row with no stroke, which misses WCAG 2.5.8's 24px target; boxed meets it.
type'button' | 'submit' | 'reset'= 'button'
The native button type: only an explicit 'submit' or 'reset' acts on a form.
nonInteractiveboolean
Renders an inert <span> with the button's look, for a label that does nothing.
border'none' | 'single' | 'rounded' | 'heavy' | 'double'
The style of every side of the boxed ring: single, rounded, heavy, double or none.
borderX'none' | 'single' | 'rounded' | 'heavy' | 'double'
The style of the boxed ring's start and end sides, over border.
borderY'none' | 'single' | 'rounded' | 'heavy' | 'double'
The style of the boxed ring's top and bottom sides, over border.
borderTop'none' | 'single' | 'rounded' | 'heavy' | 'double'
The style of the boxed ring's top side, over borderY and border.
borderEnd'none' | 'single' | 'rounded' | 'heavy' | 'double'
The style of the boxed ring's end side, over borderX and border.
borderBottom'none' | 'single' | 'rounded' | 'heavy' | 'double'
The style of the boxed ring's bottom side, over borderY and border.
borderStart'none' | 'single' | 'rounded' | 'heavy' | 'double'
The style of the boxed ring's start side, over borderX and border.
onClick(event: MouseEvent) => void
Called with the click event.

it also takes any other attribute of its <button>.

slots

in react, the default slot is children and each named slot a prop of its name, a function where the slot hands values; in vue, a slot; in svelte, a snippet.

default
Content after label, or the button's whole content without one.