import type { Component, ValidComponent } from "solid-js"; import { FormControlDescription, type FormControlDescriptionCommonProps, type FormControlDescriptionProps, type FormControlDescriptionRenderProps, } from "../form-control"; import type { ElementOf, PolymorphicProps } from "../polymorphic"; import { type CheckboxDataSet, useCheckboxContext } from "./checkbox-context"; export interface CheckboxDescriptionOptions extends FormControlDescriptionProps {} export interface CheckboxDescriptionCommonProps< T extends HTMLElement = HTMLElement, > extends FormControlDescriptionCommonProps {} export interface CheckboxDescriptionRenderProps extends CheckboxDescriptionCommonProps, CheckboxDataSet, FormControlDescriptionRenderProps {} export type CheckboxDescriptionProps< T extends ValidComponent | HTMLElement = HTMLElement, > = CheckboxDescriptionOptions & Partial>>; /** * The description that gives the user more information on the checkbox. */ export function CheckboxDescription( props: PolymorphicProps>, ) { const context = useCheckboxContext(); return ( > > {...context.dataset()} {...(props as CheckboxDescriptionProps)} /> ); }