Skip to content

Commit 88da061

Browse files
feat(input): add label with info popover
1 parent 0f19045 commit 88da061

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

lib/input/label/LabelWithInfo.tsx

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { Label } from "~ui/input/label/Label"
2+
import { LabelAsterix } from "~ui/input/label/LabelAsterix"
3+
import type { MayHaveChildren } from "~ui/utils/MayHaveChildren"
4+
import { classMerge } from "~ui/utils/classMerge"
5+
6+
export interface Label2Props extends MayHaveChildren {
7+
title: string
8+
subtitle?: string
9+
required?: boolean
10+
labelClass?: string
11+
disabled?: boolean
12+
id?: string
13+
}
14+
15+
export interface Label2PropsFor extends Label2Props {
16+
forId: string
17+
}
18+
19+
export function LabelWithSubtitle(p: Label2PropsFor) {
20+
return (
21+
<Label class={classMerge("flex items-end", p.labelClass)} for={p.forId} id={p.id}>
22+
<span>{p.title}</span>
23+
{p.required && <LabelAsterix />}
24+
{p.subtitle && (
25+
<>
26+
<br />
27+
<span class={"font-normal whitespace-normal"}>{p.subtitle}</span>
28+
</>
29+
)}
30+
{p.children}
31+
</Label>
32+
)
33+
}

0 commit comments

Comments
 (0)