@asnewyla/unstyled-button
v0.2.0
Published
Unstyled button primitive with accessibility
Maintainers
Readme
@asnewyla/unstyled-button
Unstyled, accessible button primitive. Renders click, keyboard, and focus behavior — plus hover/press/focus-visible state — without imposing any visual styling. The base layer under every styled component in this library.
Install
npm install @asnewyla/unstyled-buttonUsage
import { UnstyledButton } from '@asnewyla/unstyled-button';
<UnstyledButton onClick={() => {}}>Click me</UnstyledButton>
// Polymorphic
<UnstyledButton as="a" href="/home">Go home</UnstyledButton>
// Render props expose interaction state
<UnstyledButton>
{({ isHovered, isPressed, isFocusVisible }) => (
<span>{isPressed ? 'Pressed' : isHovered ? 'Hovered' : 'Idle'}</span>
)}
</UnstyledButton>License
MIT
