Skip to content

Truncate

Long text cut to a few lines, with «Show it whole» to read the rest.

import { Truncate } from '@sypnia/ui/react'

On this page
  1. A long description
  2. When to use it
  3. For everyone
  4. Props

A long description

Three lines, then the button.

This project keeps the orders, customers and products of the Northwind shop. Orders come from the website and the mobile app; payments are confirmed by the bank a few seconds later, and refunds go back to the same card. Every night a copy of everything is saved for 7 days. The team that runs it is in Medellín, and the support line answers in Spanish and English.
Code
import { Truncate } from '@sypnia/ui/react';

// Three lines, then «Show it whole».
export default function Description() {
  return (
    <Truncate lines={3}>
      This project keeps the orders, customers and products of the Northwind shop. Orders come from the website and the mobile
      app; payments are confirmed by the bank a few seconds later, and refunds go back to the same card. Every night a copy of
      everything is saved for 7 days. The team that runs it is in Medellín, and the support line answers in Spanish and English.
    </Truncate>
  );
}

When to use it

Use it when

  • Descriptions in lists or cards that would push everything down.

Do not use it when

  • The text is short: show it.
  • The rest is a different topic: Disclosure.

For everyone

  • The whole text is in the page; the button only shows it.

Props

TruncateTypeDefault
lines number 3
  1. A long description
  2. When to use it
  3. For everyone
  4. Props

    Search pages, sections and terms