summaryrefslogtreecommitdiffstats
path: root/src/ui/layouts/HList.tsx
diff options
context:
space:
mode:
authorVolpeon <git@volpeon.ink>2026-07-22 19:40:59 +0200
committerVolpeon <git@volpeon.ink>2026-07-22 19:40:59 +0200
commitc1e28224aa2e1450031669d9a7e359b63e04687d (patch)
tree68f3d8905c763a91f68001d868197effa92adafa /src/ui/layouts/HList.tsx
downloadcorvos-website-c1e28224aa2e1450031669d9a7e359b63e04687d.tar.gz
corvos-website-c1e28224aa2e1450031669d9a7e359b63e04687d.tar.bz2
corvos-website-c1e28224aa2e1450031669d9a7e359b63e04687d.zip
Init
Diffstat (limited to 'src/ui/layouts/HList.tsx')
-rw-r--r--src/ui/layouts/HList.tsx44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/ui/layouts/HList.tsx b/src/ui/layouts/HList.tsx
new file mode 100644
index 0000000..c1d870a
--- /dev/null
+++ b/src/ui/layouts/HList.tsx
@@ -0,0 +1,44 @@
1import type { HTMLTag, Polymorphic } from "corvos/plugins/jsx.ts";
2
3import type { Props as ActionButtonProps } from "../objects/ActionButton.tsx";
4
5export type Props<Tag extends HTMLTag> = Polymorphic<{
6 "as"?: Tag;
7 "pill"?: boolean;
8 "icon"?: boolean;
9 "separated"?: boolean;
10 "size"?: "gapless" | "sm" | "lg" | "xl";
11 "buttons-size"?: ActionButtonProps<Tag>["size"];
12 "buttons"?: boolean;
13}>;
14
15export const HList = <T extends HTMLTag = "ul">({
16 as: Tag = "ul" as T,
17 pill,
18 icon,
19 separated,
20 size,
21 "buttons-size": buttonsSize,
22 buttons,
23 class: cls,
24 ...props
25}: Props<T>) => (
26 <Tag
27 class:list={[
28 "l-hlist",
29 {
30 "l-hlist--pill": pill,
31 "l-hlist--icon": icon,
32 "l-hlist--separated": separated,
33 [`l-hlist--${size}`]: size,
34 [`l-hlist--buttons-${buttonsSize}`]: buttonsSize,
35 "l-hlist--buttons": buttons,
36 },
37 "js-keyboard-nav",
38 cls,
39 ]}
40 data-keyboard-nav-item="li > :first-child"
41 data-keyboard-nav-mode="nav"
42 {...props}
43 />
44);