View work

Fill button

An outlined pill whose fill sweeps in from the left and out to the right.

Behaviour

  • Reduced motion: the fill fades in and out instead of sweeping.
  • The fill sweeps in from the left on hover or keyboard focus and out to the right on leave; the label switches colour with it.
  • One CSS transition and a data attribute: React never re-renders. Touch and pen get the press colour only.

Props

PropTypeDescription
hrefstringRenders an <a> instead of a <button>.
classNamestringMerged with cn(). The colours come from foreground and background.
...restbutton / a propsEverything else goes to the element; your pointer and focus handlers run before the sweep.

Installation

npx shadcn@latest add https://purrfectui.com/r/fill-button.json

How to use

import { FillButton } from "@/components/ui/fill-button";

<FillButton>Get in touch</FillButton>
<FillButton href="/work">View work</FillButton>

Source code

Loading…

License

MIT. Copy it into your project and change it as you like.

0