Skip to documentation
Design system / Sources & standards
Current repository source
field-label.tsx
src/components/ui/field-label.tsx
This view contains the escaped source read during the deployment build. Code and policy text are unchanged. Markdown is shown as source, not rendered as a document. A new deployment refreshes the content.
"use client";
import type { ReactNode } from "react";
import { Info } from "lucide-react";
import { Button } from "@/components/ui/button";
import { Label } from "@/components/ui/label";
import {
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger,
} from "@/components/ui/tooltip";
function FieldInfo({ children }: { children: ReactNode }) {
return (
<Tooltip>
<TooltipTrigger asChild>
<Button
type="button"
variant="ghost"
size="icon-xs"
className="ml-1 align-middle"
>
<Info className="size-3 text-muted-foreground" />
<span className="sr-only">More info</span>
</Button>
</TooltipTrigger>
<TooltipContent className="max-w-xs text-xs">{children}</TooltipContent>
</Tooltip>
);
}
export function LabelWithInfo({
htmlFor,
info,
children,
}: {
htmlFor: string;
info: ReactNode;
children: ReactNode;
}) {
return (
<TooltipProvider delayDuration={0}>
<div className="flex items-center">
<Label htmlFor={htmlFor}>{children}</Label>
<FieldInfo>{info}</FieldInfo>
</div>
</TooltipProvider>
);
}
All sources and standards