Text makes your text fit in your boxes will built-in ellipsis support.
Basic
This is a simple text, nothing fancy.
import React from'react'
import{ Text, Box }from'@smooth-ui/core-sc'
functionExample(){
return<Text>This is a simple text, nothing fancy.</Text>
}
render(<Example/>)
Headings
Text component has built-in variants for h* elements.
h1. Heading
h2. Heading
h3. Heading
h4. Heading
h5. Heading
h6. Heading
import React from'react'
import{ Text, Boxer }from'@smooth-ui/core-sc'
functionExample(){
return(
<Boxermy={10}>
<Textvariant="h1">h1. Heading</Text>
<Textvariant="h2">h2. Heading</Text>
<Textvariant="h3">h3. Heading</Text>
<Textvariant="h4">h4. Heading</Text>
<Textvariant="h5">h5. Heading</Text>
<Textvariant="h6">h6. Heading</Text>
</Boxer>
)
}
render(<Example/>)
Customize Headings
Variant and semantic are two different things, you could use a variant h1 and choose to use a h2 tag using forwardedAs. In the following example, we use div for each of them.
h1. Heading
h2. Heading
h3. Heading
h4. Heading
h5. Heading
h6. Heading
import React from'react'
import{ Text, Boxer }from'@smooth-ui/core-sc'
functionExample(){
return(
<Boxermy={10}>
<TextforwardedAs="div"variant="h1">
h1. Heading
</Text>
<TextforwardedAs="div"variant="h2">
h2. Heading
</Text>
<TextforwardedAs="div"variant="h3">
h3. Heading
</Text>
<TextforwardedAs="div"variant="h4">
h4. Heading
</Text>
<TextforwardedAs="div"variant="h5">
h5. Heading
</Text>
<TextforwardedAs="div"variant="h6">
h6. Heading
</Text>
</Boxer>
)
}
render(<Example/>)
Display Headings
Traditional heading elements are designed to work best in the meat of your page content. When you need a heading to stand out, consider using a display heading—a larger, slightly more opinionated heading style. Keep in mind these headings are not responsive by default.
Display 1
Display 2
Display 3
Display 4
import React from'react'
import{ Text, Boxer }from'@smooth-ui/core-sc'
functionExample(){
return(
<Boxermy={10}>
<Textvariant="display-1">Display 1</Text>
<Textvariant="display-2">Display 2</Text>
<Textvariant="display-3">Display 3</Text>
<Textvariant="display-4">Display 4</Text>
</Boxer>
)
}
render(<Example/>)
Add a new variant
Variants are defined in texts section of your theme, you can add a variant by customizing your theme.