diff options
| author | Adam <[email protected]> | 2025-10-23 06:33:52 -0500 |
|---|---|---|
| committer | Adam <[email protected]> | 2025-10-24 12:16:32 -0500 |
| commit | 35dec0649db8f46bffd7121af9cd301668e69e8c (patch) | |
| tree | 0f283d42503b05706233f04fe80b4159d4dfdb06 /packages/ui/src/components/button.tsx | |
| parent | 78a7f7914369f3945fbe8dd0f570bd9960199780 (diff) | |
| download | opencode-35dec0649db8f46bffd7121af9cd301668e69e8c.tar.gz opencode-35dec0649db8f46bffd7121af9cd301668e69e8c.zip | |
wip: desktop work
Diffstat (limited to 'packages/ui/src/components/button.tsx')
| -rw-r--r-- | packages/ui/src/components/button.tsx | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/packages/ui/src/components/button.tsx b/packages/ui/src/components/button.tsx index cae658439..d28e25afe 100644 --- a/packages/ui/src/components/button.tsx +++ b/packages/ui/src/components/button.tsx @@ -1,26 +1,32 @@ import { Button as Kobalte } from "@kobalte/core/button" -import { type ComponentProps, splitProps } from "solid-js" +import { type ComponentProps, Show, splitProps } from "solid-js" +import { Icon, IconProps } from "./icon" export interface ButtonProps extends ComponentProps<typeof Kobalte>, Pick<ComponentProps<"button">, "class" | "classList" | "children"> { size?: "normal" | "large" variant?: "primary" | "secondary" | "ghost" + icon?: IconProps["name"] } export function Button(props: ButtonProps) { - const [split, rest] = splitProps(props, ["variant", "size", "class", "classList"]) + const [split, rest] = splitProps(props, ["variant", "size", "icon", "class", "classList"]) return ( <Kobalte {...rest} data-component="button" data-size={split.size || "normal"} data-variant={split.variant || "secondary"} + data-icon={split.icon} classList={{ ...(split.classList ?? {}), [split.class ?? ""]: !!split.class, }} > + <Show when={split.icon}> + <Icon data-slot="icon" name={split.icon!} size="small" /> + </Show> {props.children} </Kobalte> ) |
