mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-14 18:01:06 +00:00
docs(truncate): improve docs
This commit is contained in:
parent
0722076351
commit
5da50e047d
1 changed files with 4 additions and 5 deletions
|
@ -1,14 +1,13 @@
|
|||
|
||||
<script>
|
||||
import { Truncate, truncate } from "carbon-components-svelte";
|
||||
import Preview from "../../components/Preview.svelte";
|
||||
</script>
|
||||
|
||||
This utility component wraps the `.bx--text-truncate--*` CSS selectors from [carbon-components](https://github.com/carbon-design-system/carbon/blob/master/packages/components/src/globals/scss/_helper-classes.scss#L11) for single-line text truncation.
|
||||
`Truncate` provides text truncation functionality for single-line content. It implements Carbon's text truncation CSS classes and can be used as either a component or an action.
|
||||
|
||||
## Default
|
||||
|
||||
By default, text will be clamped at the end of the line. Text is wrapped with a paragraph (`p`) element. Use the [truncate action](#usetruncate) to truncate text in other elements.
|
||||
Display truncated text using the default component. Text is wrapped in a paragraph element and truncated at the end of the line.
|
||||
|
||||
<Truncate>
|
||||
Carbon Components Svelte is a Svelte component library that implements the Carbon Design System, an open source design system by IBM.
|
||||
|
@ -16,7 +15,7 @@ By default, text will be clamped at the end of the line. Text is wrapped with a
|
|||
|
||||
## Clamp front
|
||||
|
||||
Set `clamp` to `"front"` to clamp the text from the front.
|
||||
Truncate text from the beginning by setting `clamp` to `"front"`.
|
||||
|
||||
<Truncate clamp="front">
|
||||
Carbon Components Svelte is a Svelte component library that implements the Carbon Design System, an open source design system by IBM.
|
||||
|
@ -24,7 +23,7 @@ Set `clamp` to `"front"` to clamp the text from the front.
|
|||
|
||||
## use:truncate
|
||||
|
||||
The `truncate` action can be used on plain HTML elements.
|
||||
Apply truncation to any HTML element using the `truncate` action.
|
||||
|
||||
<h4 use:truncate>
|
||||
Carbon Components Svelte is a Svelte component library that implements the Carbon Design System, an open source design system by IBM.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue