use-disabled

Synchronize the state of the disabled prop with the fieldset tag

Inherit the disabled status of a parent tag type fieldset, under certain rules:

  1. The label must be on the lightDOM.

  2. The component that uses this hook must declare the prop {disabled: Boolean}.

Import

import { useDisabled } from "@atomico/hooks/use-disabled";

Sintaxis

const disabled:boolean = useDisabled(matches?: string = "fieldset");

Where:

  1. matches: Optional string, allows to change the search of the parent tag fieldset for another tag or selector compatible with Element.matches.

Example

Last updated