Skip to content

Button ​

Every button with a word in it. A button that is only an icon is an IconButton.

tsx
import { Button } from '@adecore/ui';

Variants ​

ghost, the default, has muted text and no background until hover. secondary has a border and a raised ground. Use at most one primary per screen. danger is for an irreversible deletion, danger-outline for a step that forgets rather than destroys, and positive for a step that completes something, such as a merge. inverse is dark on light and light on dark, as many sign-in buttons require.

tsx
import { Button } from '@adecore/ui';

export default function ButtonVariants() {
    return (
        <div className="flex flex-wrap items-center gap-2">
            <Button variant="primary">Publish</Button>
            <Button variant="secondary">Save draft</Button>
            <Button>Cancel</Button>
            <Button variant="danger">Delete</Button>
            <Button variant="danger-outline">Forget</Button>
            <Button variant="positive">Merge</Button>
            <Button variant="inverse">Sign in</Button>
        </div>
    );
}

md is 32 pixels tall, sm 28 and xs 24. An icon before the word is a 14 pixel Icon. With href the button is an anchor that opens in a new tab.

tsx
import { Button, Icon } from '@adecore/ui';
import { Download } from 'lucide-react';

export default function ButtonSizes() {
    return (
        <div className="flex items-center gap-2">
            <Button variant="secondary" size="xs">
                Extra small
            </Button>
            <Button variant="secondary" size="sm">
                <Icon icon={Download} size={14} />
                Small
            </Button>
            <Button variant="secondary">
                <Icon icon={Download} size={14} />
                Medium
            </Button>
            <Button variant="secondary" disabled>
                Disabled
            </Button>
            <Button variant="secondary" href="https://github.com/basmilius/adecore">
                A link
            </Button>
        </div>
    );
}

Pill ​

shape="pill" is 36 pixels tall and fully rounded, for a row of round controls. It ignores size.

tsx
import { Button, Icon } from '@adecore/ui';
import { Play } from 'lucide-react';

export default function ButtonPill() {
    return (
        <div className="flex h-9 items-center rounded-full bg-surface-hover">
            <Button variant="primary" shape="pill">
                <Icon icon={Play} size={14} />
                Continue
            </Button>
        </div>
    );
}

Props ​

Button takes every prop of a <button>, plus:

PropTypeDefault
variantButtonVariant'ghost''primary' | 'secondary' | 'ghost' | 'danger' | 'danger-outline' | 'positive' | 'inverse'
sizeButtonSize'md''xs' | 'sm' | 'md'
shapeButtonShape'default''default' | 'pill'
hrefstringRenders an anchor with target="_blank" and rel="noreferrer".
typestring'button'Set 'submit' inside a form.
refRef<HTMLButtonElement>

ButtonProps, ButtonVariant, ButtonSize and ButtonShape are exported types.

Accessibility ​

disabled is the native attribute. The button leaves the tab order and fades. Button styles no aria-disabled state; an IconButton does.

Licenses and third-party notices are listed in each package.