/components/input/small
import { dropdown } from "@hedia/hexui/components/dropdown";
import { input } from "@hedia/hexui/components/input";
import { toggleGroup } from "@hedia/hexui/components/toggle-group";
import { div } from "@hedia/html/elements";
import { mailOutlineIcon, searchOutlineIcon } from "@hedia/iconly/outline";
export default {
Default,
WithLabelAndHelpText,
WithError,
WithToggleGroupAndDropdown,
};
export function Default() {
return [
input({ name: "search", placeholder: "Search", size: "sm", type: "search" }),
input({
leadingIcon: searchOutlineIcon(),
name: "search",
placeholder: "Search",
size: "sm",
type: "search",
}),
input({ placeholder: "Password", size: "sm", type: "password" }),
input({ copyable: true, readonly: true, size: "sm", value: "hda_3f9c2e1b" }),
];
}
export function WithLabelAndHelpText() {
return [
input({
helpText: "We'll never share your email with anyone else.",
id: "email-small",
label: "Email address",
leadingIcon: mailOutlineIcon(),
name: "email",
placeholder: "you@example.com",
size: "sm",
type: "email",
}),
];
}
export function WithError() {
return [
input({
error: true,
errorText: "Email is required",
leadingIcon: mailOutlineIcon(),
name: "email",
placeholder: "Email",
size: "sm",
type: "email",
}),
];
}
export function WithToggleGroupAndDropdown() {
return [
div(
{ style: "display: flex; gap: 0.5rem; align-items: center" },
toggleGroup({ size: "sm" }, { label: "All", active: true }),
dropdown(
{ placeholder: "Compare", size: "sm" },
{ type: "link", href: "#da", title: "Danish" },
{ type: "link", href: "#de", title: "German" },
),
div(
{ style: "flex: 1; min-width: 0" },
input({
leadingIcon: searchOutlineIcon(),
name: "search",
placeholder: "Search",
size: "sm",
type: "search",
}),
),
),
];
}