UNPKG

821 BJavaScriptView Raw
1import React, { forwardRef } from 'react';
2import PropTypes from 'prop-types';
3import classNames from 'classnames';
4import { mapToCssModules, tagPropType } from './utils';
5
6const propTypes = {
7 /** Add custom class */
8 className: PropTypes.string,
9 /** Change underlying component's CSS base class name */
10 cssModule: PropTypes.object,
11 /** Set a custom element for this component */
12 tag: tagPropType,
13};
14
15const ListInlineItem = forwardRef((props, ref) => {
16 const { className, cssModule, tag: Tag = 'li', ...attributes } = props;
17 const classes = mapToCssModules(
18 classNames(className, 'list-inline-item'),
19 cssModule,
20 );
21
22 return <Tag {...attributes} className={classes} ref={ref} />;
23});
24
25ListInlineItem.name = 'ListInlineItem';
26ListInlineItem.propTypes = propTypes;
27
28export default ListInlineItem;
29
\No newline at end of file