diff options
| author | Adam <[email protected]> | 2025-10-22 17:31:44 -0500 |
|---|---|---|
| committer | Adam <[email protected]> | 2025-10-22 17:31:49 -0500 |
| commit | 89b703c387aed3ee918d826b788b4be1729bdde9 (patch) | |
| tree | 9a22d26bfc5e921789924e2344d04113660b67a3 /packages/ui/src/components/icon-button.tsx | |
| parent | eff12cb48453e45590a53a7705c5044a0da9e7f7 (diff) | |
| download | opencode-89b703c387aed3ee918d826b788b4be1729bdde9.tar.gz opencode-89b703c387aed3ee918d826b788b4be1729bdde9.zip | |
wip: desktop work
Diffstat (limited to 'packages/ui/src/components/icon-button.tsx')
| -rw-r--r-- | packages/ui/src/components/icon-button.tsx | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/packages/ui/src/components/icon-button.tsx b/packages/ui/src/components/icon-button.tsx new file mode 100644 index 000000000..f483f92a7 --- /dev/null +++ b/packages/ui/src/components/icon-button.tsx @@ -0,0 +1,27 @@ +import { Button as Kobalte } from "@kobalte/core/button" +import { type ComponentProps, splitProps } from "solid-js" +import { Icon, IconProps } from "./icon" + +export interface IconButtonProps { + icon: IconProps["name"] + size?: "normal" | "large" + variant?: "primary" | "secondary" | "ghost" +} + +export function IconButton(props: ComponentProps<"button"> & IconButtonProps) { + const [split, rest] = splitProps(props, ["variant", "size", "class", "classList"]) + return ( + <Kobalte + {...rest} + data-component="icon-button" + data-size={split.size || "normal"} + data-variant={split.variant || "secondary"} + classList={{ + ...(split.classList ?? {}), + [split.class ?? ""]: !!split.class, + }} + > + <Icon data-slot="icon" name={props.icon} size={split.size === "large" ? "normal" : "small"} /> + </Kobalte> + ) +} |
