Button Micro

Underlined text that acts as a button or a link.

Usage

For small actions next to content: clearing a filter, opening a changelog. It renders a button unless you pass as.

tsx
<ButtonMicro onClick={reset}>clear filters</ButtonMicro>

<ButtonMicro as="a" href={href} target="_blank" rel="noreferrer">
  changelog
</ButtonMicro>
changelog

Active

The table of contents on the right of these pages is a list of them.

tsx
<ul className="flex flex-col items-end">
  {sections.map((section) => (
    <li key={section.id}>
      <ButtonMicro
        as="a"
        href={`#${section.id}`}
        active={section.id === current}
        aria-current={section.id === current ? "true" : undefined}
      >
        {section.title}
      </ButtonMicro>
    </li>
  ))}
</ul>

Reference

proptypedefault
as?ElementType"button"the element or component to render
active?booleanfalseaccent colour; visual only
className?string—added after the component's own class: what you set wins
…restprops of as—typed against the chosen element