Getting StartedComponentsDesign TokensThemingTheme SynthesizerFrameworksAccessibilityUtilitiesServer RenderingBrowser SupportContributingChangelog App ShellAspect GridAuth ShellCenterClusterContainerDashboard GridDockFloat BarInsetMasonryPage HeaderPage LayoutResizableResponsive SwitcherSectionSettings LayoutSplit PaneStatus BarStickyToolbar Anchor NavBottom NavBreadcrumbBreadcrumb MenuCommand BarDrawerFooterLinkMenubarNavigation MenuPage IndicatorPaginationRailScroll IndicatorScroll SpyScroll To TopSidebarSkip LinkSpeed DialStepper NavTabsTop BarTree View AccordionAspect RatioAvatarAvatar GroupCalloutCardCarouselCollapsibleColor SwatchCTA BannerDividerEmpty StateFeature CardIconImageImage CompareImage HotspotsInfinite ScrollLightboxMarqueeQR CodeScroll AreaSeparatorSkeletonSpinnerStackVideoVirtual List Activity HeatmapAnimated NumberBadgeChartClockComparisonCountdown TimerData GridData TableDescription ListDiffEvent CalendarGaugeJSON TreeKanbanKey ValueLevel MeterListMeterSparklineStatStepperTableTagTimelineUptimeValue CardWaveform BlockquoteCode BlockGradient TextHighlightKbdKeyboard MapMarkdownNumber FormatProseTerminalTextTime AgoTruncateTypewriter ButtonButton GroupCalendarCheckboxChipColor PickerComboboxCopy ButtonDate PickerDate Range PickerFieldsetFile UploadFormHotkeyIcon ButtonImage CropperInline EditInputInput GroupKnobLabelMasked InputMulti SelectNumber InputOTP InputPassword InputPin InputRadio GroupRange SliderRatingSearchSegmented ControlSelectSignature PadSliderSortable ListSwitch GroupTag InputTextareaTheme ToggleTime PickerToggleTransfer ListTree Select AlertAnnouncementBannerCommand PaletteConfirmConnection StatusContext MenuConversationDialogDropdown MenuGuided TourHover CardInline MessageLoading OverlayModalNotification PanelPopoverProgressProgress ToastSheetSnackbarSpotlightToastTooltip
ARC UI ARC Radiant Components
v3.2 Docs Components Tokens Synthesizer
Getting StartedFrameworksServer Rendering Design TokensThemingTheme SynthesizerTypographyUtilities All ComponentsAccessibilityBrowser SupportChangelogContributingStats App ShellAspect GridAuth ShellCenterClusterContainerDashboard GridDockFloat BarInsetMasonryPage HeaderPage LayoutResizableResponsive SwitcherSectionSettings LayoutSplit PaneStatus BarStickyToolbar Anchor NavBottom NavBreadcrumbBreadcrumb MenuCommand BarDrawerFooterLinkMenubarNavigation MenuPage IndicatorPaginationRailScroll IndicatorScroll SpyScroll To TopSidebarSkip LinkSpeed DialStepper NavTabsTop BarTree View AccordionAspect RatioAvatarAvatar GroupCalloutCardCarouselCollapsibleColor SwatchCTA BannerDividerEmpty StateFeature CardIconImageImage CompareImage HotspotsInfinite ScrollLightboxMarqueeQR CodeScroll AreaSeparatorSkeletonSpinnerStackVideoVirtual List Activity HeatmapAnimated NumberBadgeChartClockComparisonCountdown TimerData GridData TableDescription ListDiffEvent CalendarGaugeJSON TreeKanbanKey ValueLevel MeterListMeterSparklineStatStepperTableTagTimelineUptimeValue CardWaveform BlockquoteCode BlockGradient TextHighlightKbdKeyboard MapMarkdownNumber FormatProseTerminalTextTime AgoTruncateTypewriter ButtonButton GroupCalendarCheckboxChipColor PickerComboboxCopy ButtonDate PickerDate Range PickerFieldsetFile UploadFormHotkeyIcon ButtonImage CropperInline EditInputInput GroupKnobLabelMasked InputMulti SelectNumber InputOTP InputPassword InputPin InputRadio GroupRange SliderRatingSearchSegmented ControlSelectSignature PadSliderSortable ListSwitch GroupTag InputTextareaTheme ToggleTime PickerToggleTransfer ListTree Select AlertAnnouncementBannerCommand PaletteConfirmConnection StatusContext MenuConversationDialogDropdown MenuGuided TourHover CardInline MessageLoading OverlayModalNotification PanelPopoverProgressProgress ToastSheetSnackbarSpotlightToastTooltip

Truncate

Multi-line text clamping with expandable show-more toggle.

Components Truncate
typography interactive
<arc-truncate>

Overview

Truncate clamps long text to a specified number of lines and provides a "Show more" / "Show less" toggle to expand and collapse the content. It uses CSS `-webkit-line-clamp` for native multi-line truncation, which is widely supported across all modern browsers and provides smooth, reliable clamping without JavaScript text measurement. A `ResizeObserver` monitors the content container and automatically detects whether the text actually overflows the clamp limit. The toggle button only appears when overflow is detected — short text that fits within the line limit will not show a toggle at all. When expanded, the component temporarily re-applies the clamp to measure whether the toggle should remain visible. The component fires an `arc-toggle` event with `{ expanded }` detail when toggled, and the `expanded` attribute is reflected for CSS targeting. The toggle link is styled with `var(--accent-primary)` and uppercase lettering consistent with the design system's action links.

Guidelines

When to use

  • Use for long descriptions, comments, or bio text that would dominate the layout
  • Set lines="2" or lines="3" for card descriptions and list item summaries
  • Use in combination with cards or list items to keep uniform heights
  • Test with varying content lengths to ensure the toggle appears correctly

When not to use

  • Do not use Truncate for single-line text — use CSS text-overflow: ellipsis instead
  • Do not set lines to 1 — the clamping behavior is designed for multi-line content
  • Do not Truncate interactive content like forms or buttons — only use for text
  • Do not nest Truncate components — expanding one inside another creates confusing behavior

Features

  • CSS-native multi-line text clamping via -webkit-line-clamp
  • Automatic overflow detection — toggle only appears when text exceeds line limit
  • ResizeObserver for responsive re-measurement on container resize
  • Configurable line count via lines attribute
  • Reflected expanded attribute for CSS-based conditional styling
  • Show more / Show less toggle with accent-primary styling

Preview

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Usage

This component requires JavaScript. No pure HTML/CSS version is available — use the Web Component directly or a framework wrapper.

<arc-truncate lines="3">
  Lorem ipsum dolor sit amet, consectetur adipiscing elit.
  Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
  Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris.
  Duis aute irure dolor in reprehenderit in voluptate velit esse.
</arc-truncate>
import { Truncate } from '@arclux/arc-ui-react';

export default function Example() {
  return (
    <Truncate lines={3} onArcToggle={(e) => console.log(e.detail.expanded)}>
      Lorem ipsum dolor sit amet, consectetur adipiscing elit.
      Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
      Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris.
    </Truncate>
  );
}
<script setup>
import { Truncate } from '@arclux/arc-ui-vue';
</script>

<template>
  <Truncate :lines="3" @arc-toggle="(e) => console.log(e.detail.expanded)">
    Lorem ipsum dolor sit amet...
  </Truncate>
</template>
<script>
  import { Truncate } from '@arclux/arc-ui-svelte';
</script>

<Truncate lines={3} on:arc-toggle={(e) => console.log(e.detail.expanded)}>
  Lorem ipsum dolor sit amet...
</Truncate>
import { Component } from '@angular/core';
import { Truncate } from '@arclux/arc-ui-angular';

@Component({
  imports: [Truncate],
  template: `
    <arc-truncate [lines]="3" (arc-toggle)="onToggle($event)">
      Lorem ipsum dolor sit amet...
    </arc-truncate>
  `,
})
export class MyComponent {
  onToggle(e: CustomEvent) { console.log(e.detail.expanded); }
}
import { Truncate } from '@arclux/arc-ui-solid';

export default function Example() {
  return (
    <Truncate lines={3}>
      Lorem ipsum dolor sit amet...
    </Truncate>
  );
}
import { Truncate } from '@arclux/arc-ui-preact';

export default function Example() {
  return (
    <Truncate lines={3}>
      Lorem ipsum dolor sit amet...
    </Truncate>
  );
}

API

lines number 3
Maximum number of visible lines before clamping
expanded boolean false
Whether the text is fully expanded

Events

arc-toggle detail: { expanded: boolean }
Fired when expand/collapse toggle is clicked, with { expanded } detail

See Also