UNPKG

@workday/canvas-kit-labs-react

Version:

Canvas Kit Labs is an incubator for new and experimental components. Since we have a rather rigorous process for getting components in at a production level, it can be valuable to make them available earlier while we continuously iterate on the API/functi

17 lines (16 loc) 555 B
import { createElemPropsHook } from '@workday/canvas-kit-react/common'; import { useExpandableModel } from './useExpandableModel'; export const useExpandableTarget = createElemPropsHook(useExpandableModel)(({ state, events }) => { return { 'aria-controls': state.id, 'aria-expanded': state.visibility !== 'hidden', onClick: (event) => { if (state.visibility !== 'hidden') { events.hide(event); } else { events.show(event); } }, }; });