UNPKG

@primer/react

Version:

An implementation of GitHub's Primer Design System using React

36 lines (33 loc) 858 B
import React from 'react'; import { clsx } from 'clsx'; import classes from './Truncate.module.css.js'; import { jsx } from 'react/jsx-runtime'; const Truncate = /*#__PURE__*/React.forwardRef(function Truncate({ as: Component = 'div', children, className, title, inline, expandable, maxWidth = 125, style, ...rest }, ref) { return /*#__PURE__*/jsx(Component, { ...rest, ref: ref, className: clsx(className, classes.Truncate), "data-expandable": expandable, "data-inline": inline, title: title, style: { ...style, [`--truncate-max-width`]: typeof maxWidth === 'number' ? `${maxWidth}px` : typeof maxWidth === 'string' ? maxWidth : undefined }, children: children }); }); if (process.env.NODE_ENV !== "production") { Truncate.displayName = 'Truncate'; } export { Truncate as default };