/
Alex_Ural
/
opencode
Обзор
Документация
Войти
/
Alex_Ural
/
opencode
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
packages/ui/src/components/button.tsx
33 строки
994 B
Kit Langton
feat: add oxlint with correctness defaults (#22682)
16 апр 2026, 03:45
Не верифицирован
16 апр 2026, 03:45
3d6f90c
Код
Авторство
О чём код?
import { Button as Kobalte } from "@kobalte/core/button" 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?: "small" | "normal" | "large" variant?: "primary" | "secondary" | "ghost" icon?: IconProps["name"] } export function Button(props: ButtonProps) { 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 name={split.icon!} size="small" /> </Show> {props.children} </Kobalte> ) }