yarn add @twilio-paste/truncate - or - yarn add @twilio-paste/core
import {Truncate} from '@twilio-paste/core/truncate';
const Component: React.FC = () => {
return (
<Box maxWidth="size20">
<Text as="p">
<Truncate title="Some very long text to truncate">Some very long text to truncate</Truncate>
</Text>
</Box>
);
};
title RequiredRequired
An accessible label that should match the content of the truncated text. Allows users to see the truncated content.
- Type
string
as
Controls the HTML element that that will be rendered in the DOM.
- Type
keyof IntrinsicElements
Inherited props
Paste components will often extend native HTML elements and as a result will inherit or extend their available properties. Below is a list of the props this component has inherited and are also available to use.
about
- Type
string
accessKey
- Type
string
aria-activedescendant
Identifies the currently active element when DOM focus is on a composite widget, textbox, group, or application.
- Type
string
aria-atomic
Indicates whether assistive technologies will present all, or only parts of, the changed region based on the change notifications defined by the aria-relevant attribute.
- Type
Booleanish
aria-autocomplete
Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be presented if they are made.
- Type
"list" | "none" | "inline" | "both"
aria-busy
Indicates an element is being modified and that assistive technologies MAY want to wait until the modifications are complete before exposing them to the user.
- Type
Booleanish
aria-checked
Indicates the current "checked" state of checkboxes, radio buttons, and other widgets.
- Type
boolean | "true" | "false" | "mixed"
aria-colcount
Defines the total number of columns in a table, grid, or treegrid.
- Type
number
aria-colindex
Defines an element's column index or position with respect to the total number of columns within a table, grid, or treegrid.
- Type
number
aria-colspan
Defines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid.
- Type
number
aria-controls
Identifies the element (or elements) whose contents or presence are controlled by the current element.
- Type
string
aria-current
Indicates the element that represents the current item within a container or set of related elements.
- Type
| boolean | "time" | "true" | "false" | "page" | "step" | "location" | "date"
aria-describedby
Identifies the element (or elements) that describes the object.
- Type
string
aria-details
Identifies the element that provides a detailed, extended description for the object.
- Type
string
aria-disabled
Indicates that the element is perceivable but disabled, so it is not editable or otherwise operable.
- Type
Booleanish
aria-dropeffect
Indicates what functions can be performed when a dragged object is released on the drop target.
- Type
"link" | "none" | "copy" | "execute" | "move" | "popup"
aria-errormessage
Identifies the element that provides an error message for the object.
- Type
string
aria-expanded
Indicates whether the element, or another grouping element it controls, is currently expanded or collapsed.
- Type
Booleanish
aria-flowto
Identifies the next element (or elements) in an alternate reading order of content which, at the user's discretion, allows assistive technology to override the general default of reading in document source order.
- Type
string
aria-grabbed
Indicates an element's "grabbed" state in a drag-and-drop operation.
- Type
Booleanish
aria-haspopup
Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an element.
- Type
| boolean | "dialog" | "menu" | "true" | "false" | "grid" | "listbox" | "tree"
aria-hidden
Indicates whether the element is exposed to an accessibility API.
- Type
Booleanish
aria-invalid
Indicates the entered value does not conform to the format expected by the application.
- Type
boolean | "true" | "false" | "grammar" | "spelling"
aria-keyshortcuts
Indicates keyboard shortcuts that an author has implemented to activate or give focus to an element.
- Type
string
aria-label
Defines a string value that labels the current element.
- Type
string
aria-labelledby
Identifies the element (or elements) that labels the current element.
- Type
string
aria-level
Defines the hierarchical level of an element within a structure.
- Type
number
aria-live
Indicates that an element will be updated, and describes the types of updates the user agents, assistive technologies, and user can expect from the live region.
- Type
"off" | "assertive" | "polite"
aria-modal
Indicates whether an element is modal when displayed.
- Type
Booleanish
aria-multiline
Indicates whether a text box accepts multiple lines of input or only a single line.
- Type
Booleanish
aria-multiselectable
Indicates that the user may select more than one item from the current selectable descendants.
- Type
Booleanish
aria-orientation
Indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous.
- Type
"horizontal" | "vertical"
aria-owns
Identifies an element (or elements) in order to define a visual, functional, or contextual parent/child relationship between DOM elements where the DOM hierarchy cannot be used to represent the relationship.
- Type
string
aria-placeholder
Defines a short hint (a word or short phrase) intended to aid the user with data entry when the control has no value. A hint could be a sample value or a brief description of the expected format.
- Type
string
aria-posinset
Defines an element's number or position in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM.
- Type
number
aria-pressed
Indicates the current "pressed" state of toggle buttons.
- Type
boolean | "true" | "false" | "mixed"
aria-readonly
Indicates that the element is not editable, but is otherwise operable.
- Type
Booleanish
aria-relevant
Indicates what notifications the user agent will trigger when the accessibility tree within a live region is modified.
- Type
| "text" | "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals"
aria-required
Indicates that user input is required on the element before a form may be submitted.
- Type
Booleanish
aria-roledescription
Defines a human-readable, author-localized description for the role of an element.
- Type
string
aria-rowcount
Defines the total number of rows in a table, grid, or treegrid.
- Type
number
aria-rowindex
Defines an element's row index or position with respect to the total number of rows within a table, grid, or treegrid.
- Type
number
aria-rowspan
Defines the number of rows spanned by a cell or gridcell within a table, grid, or treegrid.
- Type
number
aria-selected
Indicates the current "selected" state of various widgets.
- Type
Booleanish
aria-setsize
Defines the number of items in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM.
- Type
number
aria-sort
Indicates if items in a table or grid are sorted in ascending or descending order.
- Type
"none" | "ascending" | "descending" | "other"
aria-valuemax
Defines the maximum allowed value for a range widget.
- Type
number
aria-valuemin
Defines the minimum allowed value for a range widget.
- Type
number
aria-valuenow
Defines the current value for a range widget.
- Type
number
aria-valuetext
Defines the human readable text alternative of aria-valuenow for a range widget.
- Type
string
autoCapitalize
- Type
string
autoCorrect
- Type
string
autoSave
- Type
string
contentEditable
- Type
Booleanish | "inherit"
contextMenu
- Type
string
dangerouslySetInnerHTML
- Type
{ __html: string }
datatype
- Type
string
defaultChecked
- Type
boolean
defaultValue
- Type
string | number | readonly string[]
dir
- Type
string
draggable
- Type
Booleanish
hidden
- Type
boolean
id
- Type
string
inlist
- Type
any
inputMode
Hints at the type of data that might be entered by the user while editing the element or its contents
- Type
| "text" | "none" | "search" | "tel" | "url" | "email" | "numeric" | "decimal"
is
Specify that a standard HTML element should behave like a defined custom built-in element
- Type
string
itemID
- Type
string
itemProp
- Type
string
itemRef
- Type
string
itemScope
- Type
boolean
itemType
- Type
string
key
- Type
Key
lang
- Type
string
nonce
- Type
string
onAbort
- Type
ReactEventHandler<HTMLSpanElement>
onAbortCapture
- Type
ReactEventHandler<HTMLSpanElement>
onAnimationEnd
- Type
AnimationEventHandler<HTMLSpanElement>
onAnimationEndCapture
- Type
AnimationEventHandler<HTMLSpanElement>
onAnimationIteration
- Type
AnimationEventHandler<HTMLSpanElement>
onAnimationIterationCapture
- Type
AnimationEventHandler<HTMLSpanElement>
onAnimationStart
- Type
AnimationEventHandler<HTMLSpanElement>
onAnimationStartCapture
- Type
AnimationEventHandler<HTMLSpanElement>
onAuxClick
- Type
MouseEventHandler<HTMLSpanElement>
onAuxClickCapture
- Type
MouseEventHandler<HTMLSpanElement>
onBeforeInput
- Type
FormEventHandler<HTMLSpanElement>
onBeforeInputCapture
- Type
FormEventHandler<HTMLSpanElement>
onBlur
- Type
FocusEventHandler<HTMLSpanElement>
onBlurCapture
- Type
FocusEventHandler<HTMLSpanElement>
onCanPlay
- Type
ReactEventHandler<HTMLSpanElement>
onCanPlayCapture
- Type
ReactEventHandler<HTMLSpanElement>
onCanPlayThrough
- Type
ReactEventHandler<HTMLSpanElement>
onCanPlayThroughCapture
- Type
ReactEventHandler<HTMLSpanElement>
onChange
- Type
FormEventHandler<HTMLSpanElement>
onChangeCapture
- Type
FormEventHandler<HTMLSpanElement>
onClick
- Type
MouseEventHandler<HTMLSpanElement>
onClickCapture
- Type
MouseEventHandler<HTMLSpanElement>
onCompositionEnd
- Type
CompositionEventHandler<HTMLSpanElement>
onCompositionEndCapture
- Type
CompositionEventHandler<HTMLSpanElement>
onCompositionStart
- Type
CompositionEventHandler<HTMLSpanElement>
onCompositionStartCapture
- Type
CompositionEventHandler<HTMLSpanElement>
onCompositionUpdate
- Type
CompositionEventHandler<HTMLSpanElement>
onCompositionUpdateCapture
- Type
CompositionEventHandler<HTMLSpanElement>
onContextMenu
- Type
MouseEventHandler<HTMLSpanElement>
onContextMenuCapture
- Type
MouseEventHandler<HTMLSpanElement>
onCopy
- Type
ClipboardEventHandler<HTMLSpanElement>
onCopyCapture
- Type
ClipboardEventHandler<HTMLSpanElement>
onCut
- Type
ClipboardEventHandler<HTMLSpanElement>
onCutCapture
- Type
ClipboardEventHandler<HTMLSpanElement>
onDoubleClick
- Type
MouseEventHandler<HTMLSpanElement>
onDoubleClickCapture
- Type
MouseEventHandler<HTMLSpanElement>
onDrag
- Type
DragEventHandler<HTMLSpanElement>
onDragCapture
- Type
DragEventHandler<HTMLSpanElement>
onDragEnd
- Type
DragEventHandler<HTMLSpanElement>
onDragEndCapture
- Type
DragEventHandler<HTMLSpanElement>
onDragEnter
- Type
DragEventHandler<HTMLSpanElement>
onDragEnterCapture
- Type
DragEventHandler<HTMLSpanElement>
onDragExit
- Type
DragEventHandler<HTMLSpanElement>
onDragExitCapture
- Type
DragEventHandler<HTMLSpanElement>
onDragLeave
- Type
DragEventHandler<HTMLSpanElement>
onDragLeaveCapture
- Type
DragEventHandler<HTMLSpanElement>
onDragOver
- Type
DragEventHandler<HTMLSpanElement>
onDragOverCapture
- Type
DragEventHandler<HTMLSpanElement>
onDragStart
- Type
DragEventHandler<HTMLSpanElement>
onDragStartCapture
- Type
DragEventHandler<HTMLSpanElement>
onDrop
- Type
DragEventHandler<HTMLSpanElement>
onDropCapture
- Type
DragEventHandler<HTMLSpanElement>
onDurationChange
- Type
ReactEventHandler<HTMLSpanElement>
onDurationChangeCapture
- Type
ReactEventHandler<HTMLSpanElement>
onEmptied
- Type
ReactEventHandler<HTMLSpanElement>
onEmptiedCapture
- Type
ReactEventHandler<HTMLSpanElement>
onEncrypted
- Type
ReactEventHandler<HTMLSpanElement>
onEncryptedCapture
- Type
ReactEventHandler<HTMLSpanElement>
onEnded
- Type
ReactEventHandler<HTMLSpanElement>
onEndedCapture
- Type
ReactEventHandler<HTMLSpanElement>
onError
- Type
ReactEventHandler<HTMLSpanElement>
onErrorCapture
- Type
ReactEventHandler<HTMLSpanElement>
onFocus
- Type
FocusEventHandler<HTMLSpanElement>
onFocusCapture
- Type
FocusEventHandler<HTMLSpanElement>
onGotPointerCapture
- Type
PointerEventHandler<HTMLSpanElement>
onGotPointerCaptureCapture
- Type
PointerEventHandler<HTMLSpanElement>
onInput
- Type
FormEventHandler<HTMLSpanElement>
onInputCapture
- Type
FormEventHandler<HTMLSpanElement>
onInvalid
- Type
FormEventHandler<HTMLSpanElement>
onInvalidCapture
- Type
FormEventHandler<HTMLSpanElement>
onKeyDown
- Type
KeyboardEventHandler<HTMLSpanElement>
onKeyDownCapture
- Type
KeyboardEventHandler<HTMLSpanElement>
onKeyPress
- Type
KeyboardEventHandler<HTMLSpanElement>
onKeyPressCapture
- Type
KeyboardEventHandler<HTMLSpanElement>
onKeyUp
- Type
KeyboardEventHandler<HTMLSpanElement>
onKeyUpCapture
- Type
KeyboardEventHandler<HTMLSpanElement>
onLoad
- Type
ReactEventHandler<HTMLSpanElement>
onLoadCapture
- Type
ReactEventHandler<HTMLSpanElement>
onLoadedData
- Type
ReactEventHandler<HTMLSpanElement>
onLoadedDataCapture
- Type
ReactEventHandler<HTMLSpanElement>
onLoadedMetadata
- Type
ReactEventHandler<HTMLSpanElement>
onLoadedMetadataCapture
- Type
ReactEventHandler<HTMLSpanElement>
onLoadStart
- Type
ReactEventHandler<HTMLSpanElement>
onLoadStartCapture
- Type
ReactEventHandler<HTMLSpanElement>
onLostPointerCapture
- Type
PointerEventHandler<HTMLSpanElement>
onLostPointerCaptureCapture
- Type
PointerEventHandler<HTMLSpanElement>
onMouseDown
- Type
MouseEventHandler<HTMLSpanElement>
onMouseDownCapture
- Type
MouseEventHandler<HTMLSpanElement>
onMouseEnter
- Type
MouseEventHandler<HTMLSpanElement>
onMouseLeave
- Type
MouseEventHandler<HTMLSpanElement>
onMouseMove
- Type
MouseEventHandler<HTMLSpanElement>
onMouseMoveCapture
- Type
MouseEventHandler<HTMLSpanElement>
onMouseOut
- Type
MouseEventHandler<HTMLSpanElement>
onMouseOutCapture
- Type
MouseEventHandler<HTMLSpanElement>
onMouseOver
- Type
MouseEventHandler<HTMLSpanElement>
onMouseOverCapture
- Type
MouseEventHandler<HTMLSpanElement>
onMouseUp
- Type
MouseEventHandler<HTMLSpanElement>
onMouseUpCapture
- Type
MouseEventHandler<HTMLSpanElement>
onPaste
- Type
ClipboardEventHandler<HTMLSpanElement>
onPasteCapture
- Type
ClipboardEventHandler<HTMLSpanElement>
onPause
- Type
ReactEventHandler<HTMLSpanElement>
onPauseCapture
- Type
ReactEventHandler<HTMLSpanElement>
onPlay
- Type
ReactEventHandler<HTMLSpanElement>
onPlayCapture
- Type
ReactEventHandler<HTMLSpanElement>
onPlaying
- Type
ReactEventHandler<HTMLSpanElement>
onPlayingCapture
- Type
ReactEventHandler<HTMLSpanElement>
onPointerCancel
- Type
PointerEventHandler<HTMLSpanElement>
onPointerCancelCapture
- Type
PointerEventHandler<HTMLSpanElement>
onPointerDown
- Type
PointerEventHandler<HTMLSpanElement>
onPointerDownCapture
- Type
PointerEventHandler<HTMLSpanElement>
onPointerEnter
- Type
PointerEventHandler<HTMLSpanElement>
onPointerEnterCapture
- Type
PointerEventHandler<HTMLSpanElement>
onPointerLeave
- Type
PointerEventHandler<HTMLSpanElement>
onPointerLeaveCapture
- Type
PointerEventHandler<HTMLSpanElement>
onPointerMove
- Type
PointerEventHandler<HTMLSpanElement>
onPointerMoveCapture
- Type
PointerEventHandler<HTMLSpanElement>
onPointerOut
- Type
PointerEventHandler<HTMLSpanElement>
onPointerOutCapture
- Type
PointerEventHandler<HTMLSpanElement>
onPointerOver
- Type
PointerEventHandler<HTMLSpanElement>
onPointerOverCapture
- Type
PointerEventHandler<HTMLSpanElement>
onPointerUp
- Type
PointerEventHandler<HTMLSpanElement>
onPointerUpCapture
- Type
PointerEventHandler<HTMLSpanElement>
onProgress
- Type
ReactEventHandler<HTMLSpanElement>
onProgressCapture
- Type
ReactEventHandler<HTMLSpanElement>
onRateChange
- Type
ReactEventHandler<HTMLSpanElement>
onRateChangeCapture
- Type
ReactEventHandler<HTMLSpanElement>
onReset
- Type
FormEventHandler<HTMLSpanElement>
onResetCapture
- Type
FormEventHandler<HTMLSpanElement>
onResize
- Type
ReactEventHandler<HTMLSpanElement>
onResizeCapture
- Type
ReactEventHandler<HTMLSpanElement>
onScroll
- Type
UIEventHandler<HTMLSpanElement>
onScrollCapture
- Type
UIEventHandler<HTMLSpanElement>
onSeeked
- Type
ReactEventHandler<HTMLSpanElement>
onSeekedCapture
- Type
ReactEventHandler<HTMLSpanElement>
onSeeking
- Type
ReactEventHandler<HTMLSpanElement>
onSeekingCapture
- Type
ReactEventHandler<HTMLSpanElement>
onSelect
- Type
ReactEventHandler<HTMLSpanElement>
onSelectCapture
- Type
ReactEventHandler<HTMLSpanElement>
onStalled
- Type
ReactEventHandler<HTMLSpanElement>
onStalledCapture
- Type
ReactEventHandler<HTMLSpanElement>
onSubmit
- Type
FormEventHandler<HTMLSpanElement>
onSubmitCapture
- Type
FormEventHandler<HTMLSpanElement>
onSuspend
- Type
ReactEventHandler<HTMLSpanElement>
onSuspendCapture
- Type
ReactEventHandler<HTMLSpanElement>
onTimeUpdate
- Type
ReactEventHandler<HTMLSpanElement>
onTimeUpdateCapture
- Type
ReactEventHandler<HTMLSpanElement>
onTouchCancel
- Type
TouchEventHandler<HTMLSpanElement>
onTouchCancelCapture
- Type
TouchEventHandler<HTMLSpanElement>
onTouchEnd
- Type
TouchEventHandler<HTMLSpanElement>
onTouchEndCapture
- Type
TouchEventHandler<HTMLSpanElement>
onTouchMove
- Type
TouchEventHandler<HTMLSpanElement>
onTouchMoveCapture
- Type
TouchEventHandler<HTMLSpanElement>
onTouchStart
- Type
TouchEventHandler<HTMLSpanElement>
onTouchStartCapture
- Type
TouchEventHandler<HTMLSpanElement>
onTransitionEnd
- Type
TransitionEventHandler<HTMLSpanElement>
onTransitionEndCapture
- Type
TransitionEventHandler<HTMLSpanElement>
onVolumeChange
- Type
ReactEventHandler<HTMLSpanElement>
onVolumeChangeCapture
- Type
ReactEventHandler<HTMLSpanElement>
onWaiting
- Type
ReactEventHandler<HTMLSpanElement>
onWaitingCapture
- Type
ReactEventHandler<HTMLSpanElement>
onWheel
- Type
WheelEventHandler<HTMLSpanElement>
onWheelCapture
- Type
WheelEventHandler<HTMLSpanElement>
placeholder
- Type
string
prefix
- Type
string
property
- Type
string
radioGroup
- Type
string
resource
- Type
string
results
- Type
number
role
- Type
AriaRole
security
- Type
string
slot
- Type
string
spellCheck
- Type
Booleanish
suppressContentEditableWarning
- Type
boolean
suppressHydrationWarning
- Type
boolean
tabIndex
- Type
number
translate
- Type
"yes" | "no"
typeof
- Type
string
unselectable
- Type
"on" | "off"
vocab
- Type
string