import type { Component, ValidComponent } from "solid-js"; import { FormControlLabel, type FormControlLabelCommonProps, type FormControlLabelOptions, type FormControlLabelRenderProps, } from "../form-control"; import type { ElementOf, PolymorphicProps } from "../polymorphic"; import { type CheckboxDataSet, useCheckboxContext } from "./checkbox-context"; export interface CheckboxLabelOptions extends FormControlLabelOptions {} export interface CheckboxLabelCommonProps extends FormControlLabelCommonProps {} export interface CheckboxLabelRenderProps extends CheckboxLabelCommonProps, FormControlLabelRenderProps, CheckboxDataSet {} export type CheckboxLabelProps< T extends ValidComponent | HTMLElement = HTMLElement, > = CheckboxLabelOptions & Partial>>; /** * The label that gives the user information on the checkbox. */ export function CheckboxLabel( props: PolymorphicProps>, ) { const context = useCheckboxContext(); return ( > > {...context.dataset()} {...(props as CheckboxLabelProps)} /> ); }