@wordpress/components
Version:
UI components for WordPress.
52 lines (49 loc) • 1.1 kB
JavaScript
/**
* External dependencies
*/
/**
* Internal dependencies
*/
import { useItem } from './hook';
import { contextConnect } from '../../context';
import { View } from '../../view';
import { jsx as _jsx } from "react/jsx-runtime";
function UnconnectedItem(props, forwardedRef) {
const {
role,
wrapperClassName,
...otherProps
} = useItem(props);
return /*#__PURE__*/_jsx("div", {
role: role,
className: wrapperClassName,
children: /*#__PURE__*/_jsx(View, {
...otherProps,
ref: forwardedRef
})
});
}
/**
* `Item` is used in combination with `ItemGroup` to display a list of items
* grouped and styled together.
*
* ```jsx
* import {
* __experimentalItemGroup as ItemGroup,
* __experimentalItem as Item,
* } from '@wordpress/components';
*
* function Example() {
* return (
* <ItemGroup>
* <Item>Code</Item>
* <Item>is</Item>
* <Item>Poetry</Item>
* </ItemGroup>
* );
* }
* ```
*/
export const Item = contextConnect(UnconnectedItem, 'Item');
export default Item;
//# sourceMappingURL=component.js.map