68f4cf269d
Created by Github action <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/twentyhq/twenty/pull/22281?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. --> Co-authored-by: github-actions <github-actions@twenty.com>
154 lines
4.7 KiB
Plaintext
154 lines
4.7 KiB
Plaintext
---
|
|
title: Chip
|
|
---
|
|
|
|
<Frame>
|
|
<img src="/images/user-guide/github/github-header.png" alt="Encabezado" />
|
|
</Frame>
|
|
|
|
Un elemento visual que puedes usar como contenedor con o sin posibilidad de hacer clic, con una etiqueta, componentes opcionales a la izquierda y a la derecha y varias opciones de estilo para mostrar rótulos y etiquetas.
|
|
|
|
<Tabs>
|
|
|
|
<Tab title="Uso">
|
|
|
|
```jsx
|
|
import { Chip } from 'twenty-ui/components';
|
|
|
|
export const MyComponent = () => {
|
|
return (
|
|
<Chip
|
|
size="large"
|
|
label="Clickable Chip"
|
|
clickable={true}
|
|
variant="highlighted"
|
|
accent="text-primary"
|
|
leftComponent
|
|
rightComponent
|
|
maxWidth="200px"
|
|
className
|
|
/>
|
|
);
|
|
};
|
|
|
|
```
|
|
|
|
</Tab>
|
|
|
|
<Tab title="Props">
|
|
|
|
|
|
| Props | Tipo | Descripción |
|
|
| ------------ | ------------------------ | ------------------------------------------------------------------------------------------------ |
|
|
| linkToEntity | cadena | El enlace a la entidad |
|
|
| entityId | cadena | El identificador único de la entidad |
|
|
| nombre | cadena | El nombre de la entidad |
|
|
| pictureUrl | cadena | s foto", |
|
|
| avatarType | Tipo de Avatar | El tipo de avatar que quieres mostrar. Tiene dos opciones: `redondeado` y `cuadrado` |
|
|
| variante | `EntityChipVariant` enum | Variante del chip de entidad que quieres mostrar. Tiene dos opciones: `regular` y `transparente` |
|
|
| LeftIcon | IconComponent | Un componente de React que representa un ícono. Mostrado en el lado izquierdo del chip |
|
|
|
|
|
|
|
|
</Tab>
|
|
</Tabs>
|
|
|
|
## Ejemplos
|
|
|
|
### Chip Transparente Deshabilitado
|
|
|
|
```jsx
|
|
import { Chip } from 'twenty-ui/components';
|
|
|
|
export const MyComponent = () => {
|
|
return (
|
|
<Chip
|
|
size="large"
|
|
label="Transparent Disabled Chip"
|
|
clickable={false}
|
|
variant="rounded"
|
|
accent="text-secondary"
|
|
leftComponent
|
|
rightComponent
|
|
maxWidth="200px"
|
|
className
|
|
/>
|
|
);
|
|
};
|
|
|
|
```
|
|
|
|
<br />
|
|
|
|
### Chip Deshabilitado con Tooltip
|
|
|
|
```jsx
|
|
import { Chip } from "twenty-ui/components";
|
|
|
|
export const MyComponent = () => {
|
|
return (
|
|
<Chip
|
|
size="large"
|
|
label="Disabled chip that triggers a tooltip when overflowing."
|
|
clickable={false}
|
|
variant="regular"
|
|
accent="text-primary"
|
|
leftComponent
|
|
rightComponent
|
|
maxWidth="200px"
|
|
className
|
|
/>
|
|
);
|
|
};
|
|
```
|
|
|
|
## Chip de Entidad
|
|
|
|
Un elemento tipo Chip para mostrar información sobre una entidad.
|
|
|
|
<Tabs>
|
|
|
|
<Tab title="Uso">
|
|
|
|
```jsx
|
|
import { BrowserRouter as Router } from 'react-router-dom';
|
|
import { IconTwentyStar } from 'twenty-ui/display';
|
|
import { Chip } from 'twenty-ui/components';
|
|
|
|
export const MyComponent = () => {
|
|
return (
|
|
<Router>
|
|
<Chip
|
|
linkToEntity="/entity-link"
|
|
entityId="entityTest"
|
|
name="Entity name"
|
|
pictureUrl=""
|
|
avatarType="rounded"
|
|
variant="regular"
|
|
LeftIcon={IconTwentyStar}
|
|
/>
|
|
</Router>
|
|
);
|
|
};
|
|
```
|
|
|
|
</Tab>
|
|
|
|
<Tab title="Props">
|
|
|
|
|
|
| Props | Tipo | Descripción |
|
|
| ------------ | ------------------------ | ------------------------------------------------------------------------------------------------ |
|
|
| linkToEntity | cadena | El enlace a la entidad |
|
|
| entityId | cadena | El identificador único de la entidad |
|
|
| nombre | cadena | El nombre de la entidad |
|
|
| pictureUrl | cadena | s foto", |
|
|
| avatarType | Tipo de Avatar | El tipo de avatar que quieres mostrar. Tiene dos opciones: `redondeado` y `cuadrado` |
|
|
| variante | `EntityChipVariant` enum | Variante del chip de entidad que quieres mostrar. Tiene dos opciones: `regular` y `transparente` |
|
|
| LeftIcon | IconComponent | Un componente de React que representa un ícono. Mostrado en el lado izquierdo del chip |
|
|
|
|
|
|
|
|
</Tab>
|
|
</Tabs>
|