Truncate
Un texto largo cortado a unas pocas líneas, con «Verlo completo» para leer el resto.
import { Truncate } from '@sypnia/ui/react'
En esta página
Una descripción larga
Tres líneas y luego el botón.
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.
Código
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>
);
} Cuándo usarlo
Úsalo cuando
- Descripciones en listas o tarjetas que empujarían todo hacia abajo.
No lo uses cuando
- El texto es corto: muéstralo.
- El resto es otro tema: Disclosure.
Para todos
- El texto completo está en la página; el botón solo lo muestra.
Props
| Truncate | Tipo | Por defecto |
|---|---|---|
lines | number | 3 |