UNPKG

@itwin/itwinui-react

Version:

A react component library for iTwinUI

37 lines (36 loc) 817 B
import * as React from 'react'; import cx from 'classnames'; import { Box } from './Box.js'; import { ShadowRoot } from './ShadowRoot.js'; export const LineClamp = React.forwardRef((props, forwardedRef) => { let { lines, children, ...rest } = props; return React.createElement( Box, { ref: forwardedRef, ...rest, className: cx('iui-line-clamp', props.className), style: { '--_iui-line-clamp': lines, ...props.style, }, }, React.createElement( ShadowRoot, { css: css, flush: false, }, React.createElement('slot', null), ), children, ); }); let css = ` :host { overflow: hidden; display: -webkit-box; -webkit-line-clamp: var(--_iui-line-clamp, 3); -webkit-box-orient: vertical; } `;