30 lines
940 B
TypeScript
30 lines
940 B
TypeScript
import { h } from "vue";
|
|
import {
|
|
Button,
|
|
Input,
|
|
buttonVariants,
|
|
type ButtonProps,
|
|
} from "@heroui-vue/components";
|
|
import { tv, type VariantProps, type ButtonVariants } from "@heroui-vue/styles";
|
|
|
|
const extended = tv({
|
|
extend: buttonVariants,
|
|
variants: { intent: { quiet: "opacity-70", loud: "font-bold" } },
|
|
});
|
|
type Extended = VariantProps<typeof extended>;
|
|
const valid: Extended = { intent: "quiet", size: "sm" };
|
|
extended(valid);
|
|
const native: ButtonProps = { asChild: true, variant: "secondary" };
|
|
h(Button, native, () => h("button", { type: "button" }, "Native composition"));
|
|
h(Input, {
|
|
"aria-label": "Field",
|
|
class: ["custom"],
|
|
style: { color: "var(--foreground)" },
|
|
});
|
|
// @ts-expect-error custom intent remains typed
|
|
const badIntent: Extended = { intent: "missing" };
|
|
// @ts-expect-error built-in variants remain typed
|
|
const badVariant: ButtonVariants = { variant: "missing" };
|
|
void badIntent;
|
|
void badVariant;
|