@base-ui-components/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.
15 lines • 400 B
JavaScript
import { fieldValidityMapping } from "../field/utils/constants.js";
import { SwitchRootDataAttributes } from "./root/SwitchRootDataAttributes.js";
export const stateAttributesMapping = {
...fieldValidityMapping,
checked(value) {
if (value) {
return {
[SwitchRootDataAttributes.checked]: ''
};
}
return {
[SwitchRootDataAttributes.unchecked]: ''
};
}
};