@carbon/react
Version:
React components for the Carbon Design System
56 lines (52 loc) • 1.52 kB
JavaScript
/**
* Copyright IBM Corp. 2016, 2023
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
import PropTypes from 'prop-types';
import React from 'react';
import cx from 'classnames';
import { usePrefix } from '../../internal/usePrefix.js';
function OrderedList({
className,
nested = false,
native = false,
isExpressive = false,
...other
}) {
const prefix = usePrefix();
const classNames = cx({
[`${prefix}--list--ordered`]: !native,
[`${prefix}--list--ordered--native`]: native,
[`${prefix}--list--nested`]: nested,
[`${prefix}--list--expressive`]: isExpressive
}, className);
return /*#__PURE__*/React.createElement("ol", _extends({
className: classNames
}, other));
}
OrderedList.propTypes = {
/**
* Provide list items to be rendered in the ordered list
*/
children: PropTypes.node,
/**
* Provide an optional className to be applied to the containing <ol> node
*/
className: PropTypes.string,
/**
* Specify whether this ordered list expressive or not
*/
isExpressive: PropTypes.bool,
/**
* Specify whether this ordered list should use native list styles instead of custom counter
*/
native: PropTypes.bool,
/**
* Specify whether this ordered list is nested inside of another nested list
*/
nested: PropTypes.bool
};
export { OrderedList as default };