UNPKG

@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.

22 lines (21 loc) 593 B
'use client'; import * as React from 'react'; import { CheckboxRootDataAttributes } from "../root/CheckboxRootDataAttributes.js"; export function useCustomStyleHookMapping(state) { return React.useMemo(() => ({ checked(value) { if (state.indeterminate) { // `data-indeterminate` is already handled by the `indeterminate` prop. return {}; } if (value) { return { [CheckboxRootDataAttributes.checked]: '' }; } return { [CheckboxRootDataAttributes.unchecked]: '' }; } }), [state.indeterminate]); }