Skip to content

Latest commit

 

History

History
61 lines (40 loc) · 1.48 KB

File metadata and controls

61 lines (40 loc) · 1.48 KB

import { TextDemos } from '@docs/demos'; import { Layout } from '@/layout'; import { MDX_DATA } from '@/mdx';

export default Layout(MDX_DATA.Text);

Usage

Truncate

Set the truncate prop to add text-overflow: ellipsis styles:

Line clamp

Specify the maximum number of lines with the lineClamp prop. This option uses -webkit-line-clamp CSS property (caniuse). Note that padding-bottom cannot be set on the text element:

Line clamp can also be used with any children (not only strings), for example with Typography:

Inherit styles

Text always applies font-size, font-family and line-height styles, but in some cases this is not the desired behavior. To force Text to inherit parent styles, set the inherit prop. For example, highlight part of Title:

span prop

Use the span prop as a shorthand for component="span":

import { Text } from '@mantine/core';

function Demo() {
  return (
    <>
      <Text span>Same as below</Text>
      <Text component="span">Same as above</Text>
    </>
  );
}