feat(ui): Chip toggle
This commit is contained in:
1 parent
03332246d3
commit
a1453ec32e
1 file changed
+24
-2
@@ -1,3 +1,25 @@
|
|||||||
export default function Chip() {
|
import type { ButtonHTMLAttributes, ReactNode } from 'react'
|
||||||
return <div>Chip placeholder</div>
|
|
||||||
|
export default function Chip({
|
||||||
|
active = false,
|
||||||
|
children,
|
||||||
|
className = '',
|
||||||
|
...rest
|
||||||
|
}: ButtonHTMLAttributes<HTMLButtonElement> & { active?: boolean; children: ReactNode }) {
|
||||||
|
return (
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
aria-pressed={active}
|
||||||
|
className={[
|
||||||
|
'inline-flex items-center justify-center min-w-[40px] h-10 px-3 rounded-full border text-sm font-medium transition focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-accent)]/30',
|
||||||
|
active
|
||||||
|
? 'bg-[var(--color-accent)] text-white border-[var(--color-accent)]'
|
||||||
|
: 'bg-white text-[var(--color-ink)] border-[var(--color-border)] hover:bg-[var(--color-surface)]',
|
||||||
|
className,
|
||||||
|
].join(' ')}
|
||||||
|
{...rest}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</button>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user