Button

Actions. One component for every desktop button: main action, secondary, filter, and buttons on the dark bulk bar. Height is always 28.

Open in Figma

Usage

import { Button } from '@pilar-amoda/ui/button';

Variants

default is the main action; outline is secondary.

import { Button } from '@pilar-amoda/ui/button';

export const ButtonVariants = () => (
  <>
    <Button>Alokasikan</Button>
    <Button variant="outline">Export</Button>
  </>
);

Filter

outline + size="compact". aria-expanded shows the open state while the filter popover is open.

'use client';

import { useState } from 'react';

import { Button } from '@pilar-amoda/ui/button';

/** Filter button: outline + compact. aria-expanded shows the "open" state while its popover is open. */
export const ButtonFilter = () => {
  const [open, setOpen] = useState(false);

  return (
    <Button
      variant="outline"
      size="compact"
      aria-expanded={open}
      onClick={() => setOpen((value) => !value)}
    >
      Filter
    </Button>
  );
};

Loading and disabled

Loading shows a 12 px spinner in place of the icon and blocks clicks; disabled is 50% opacity.

import { Button } from '@pilar-amoda/ui/button';

export const ButtonStates = () => (
  <>
    <Button loading>Alokasikan</Button>
    <Button variant="outline" loading>
      Export
    </Button>
    <Button disabled>Alokasikan</Button>
    <Button variant="outline" disabled>
      Export
    </Button>
  </>
);

On the bulk bar

inverse and inverse-primary only, always compact.

import { Button } from '@pilar-amoda/ui/button';

/** Inverse variants only live on the dark bulk bar, always with size="compact". */
export const ButtonBulkBar = () => (
  <>
    <Button variant="inverse" size="compact">
      Export
    </Button>
    <Button variant="inverse-primary" size="compact">
      Alokasikan bersama
    </Button>
    <Button variant="inverse-primary" size="compact" loading>
      Mengalokasikan…
    </Button>
  </>
);

Props

PropTypeDefault
variant"default" | "outline" | "inverse" | "inverse-primary""default"
size"default" | "compact""default"
loadingbooleanfalse
disabledbooleanfalse
renderBase UI render prop, e.g. render={<a href="…" />}—

Do and don't

Do: one default (primary) button per row or area.
Don't: put two main actions next to each other.
Do: use inverse variants only on the dark bulk bar.