Files
element-plus/packages/hooks/use-aria/index.ts
kooriookami bd1613d599 feat(hooks): add use-aria hooks (#16598)
* feat(hooks): add use-aria hooks

* feat(components): update

* feat(hooks): update

* feat(hooks): update
2024-04-23 13:56:44 +08:00

27 lines
605 B
TypeScript

import { pick } from 'lodash-unified'
import { buildProps } from '@element-plus/utils'
export const ariaProps = buildProps({
/**
* @description native `aria-label` attribute
*/
ariaLabel: String,
/**
* @description native `aria-orientation` attribute
*/
ariaOrientation: {
type: String,
values: ['horizontal', 'vertical', 'undefined'],
},
/**
* @description native `aria-controls` attribute
*/
ariaControls: String,
})
export const useAriaProps = <T extends keyof typeof ariaProps>(
arias: Array<T>
) => {
return pick<typeof ariaProps, T>(ariaProps, arias)
}