@base-ui/react
Version:
Base UI is a library of headless ('unstyled') React components and low-level hooks. You gain complete control over your app's CSS and accessibility features.
20 lines • 495 B
JavaScript
import { fieldValidityMapping } from "../../internals/field-constants/constants.mjs";
export function getCheckboxStateAttributesMapping(state) {
return {
checked(value) {
if (state.indeterminate) {
// `data-indeterminate` is already handled by the `indeterminate` prop.
return {};
}
if (value) {
return {
'data-checked': ''
};
}
return {
'data-unchecked': ''
};
},
...fieldValidityMapping
};
}