Debian Codegraph @

node/@patternfly/react-core/src/components/List/ListItem.tsx

raw
1 import styles from '@patternfly/react-styles/css/components/List/list';
2 import { css } from '@patternfly/react-styles';
3
4 export interface ListItemProps extends React.HTMLProps<HTMLLIElement> {
5 /** Additional classes added to the list item */
6 className?: string;
7 /** Anything that can be rendered inside of list item */
8 children: React.ReactNode;
9 /** Icon for the list item */
10 icon?: React.ReactNode | null;
11 }
12
13 export const ListItem: React.FunctionComponent<ListItemProps> = ({
14 className,
15 children = null,
16 icon = null,
17 ...props
18 }: ListItemProps) => (
19 <li className={css(icon && styles.listItem, className)} {...props}>
20 {icon && <span className={css(styles.listItemIcon)}>{icon}</span>}
21 <span className={icon && css(`${styles.list}__item-text`)}>{children}</span>
22 </li>
23 );
24 ListItem.displayName = 'ListItem';