@primer/react
Version:
An implementation of GitHub's Primer Design System using React
24 lines (23 loc) • 829 B
JavaScript
import Truncate_module_css_default from "./Truncate.module.css.js";
import { clsx } from "clsx";
import { jsx } from "react/jsx-runtime";
import React from "react";
//#region src/Truncate/Truncate.tsx
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,
className: clsx(className, Truncate_module_css_default.Truncate),
"data-expandable": expandable,
"data-inline": inline,
title,
style: {
...style,
[`--truncate-max-width`]: typeof maxWidth === "number" ? `${maxWidth}px` : typeof maxWidth === "string" ? maxWidth : void 0
},
children
});
});
Truncate.displayName = "Truncate";
//#endregion
export { Truncate as default };