e02c24bd3a
Created by Github action --------- Co-authored-by: Abdul Rahman <ar5438376@gmail.com> Co-authored-by: Crowdin Bot <support+bot@crowdin.com> Co-authored-by: github-actions <github-actions@twenty.com> Co-authored-by: Charles Bochet <charles@twenty.com>
149 lines
4.7 KiB
Plaintext
149 lines
4.7 KiB
Plaintext
---
|
|
title: 芯片
|
|
image: /images/user-guide/github/github-header.png
|
|
---
|
|
|
|
<Frame>
|
|
<img src="/images/user-guide/github/github-header.png" alt="Header" />
|
|
</Frame>
|
|
|
|
一種視覺元素,可用作帶標籤的可點擊或不可點擊的容器,並可選擇添加左側和右側組件,以及用於顯示標籤和標籤的各種樣式選項。
|
|
|
|
<Tabs>
|
|
|
|
<Tab title="Usage">
|
|
|
|
```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">
|
|
|
|
| 屬性 | 類型 | 描述 |
|
|
| ------------ | ---------------------- | ------------------------------------------------------------------------------ |
|
|
| linkToEntity | 字串 | 實體的鏈接 |
|
|
| entityId | 字串 | 實體的唯一標識符 |
|
|
| 名稱 | 字串 | 實體的名稱 |
|
|
| 圖片URL | 字串 | 的圖片"," |
|
|
| avatarType | 頭像類型 | 您要顯示的頭像類型。 您要顯示的頭像類型。 Has two options: `rounded` and `squared` |
|
|
| 變體 | `EntityChipVariant` 枚舉 | 你要顯示的實體芯片的變體。 有兩種選擇:`常規`和`透明` |
|
|
| 左圖標 | 圖標組件 | 一個代表圖標的 React 組件。 顯示在芯片的左側 |
|
|
|
|
</Tab>
|
|
</Tabs>
|
|
|
|
## Examples
|
|
|
|
### Transparent Disabled Chip
|
|
|
|
```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/>
|
|
|
|
### Disabled Chip with 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
|
|
/>
|
|
);
|
|
};
|
|
```
|
|
|
|
## 實體芯片
|
|
|
|
一個芯片狀元素,用於顯示有關實體的信息。
|
|
|
|
<Tabs>
|
|
|
|
<Tab title="Usage">
|
|
|
|
```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">
|
|
|
|
| 屬性 | 類型 | 描述 |
|
|
| ------------ | ---------------------- | ------------------------------------------------------------------------------ |
|
|
| linkToEntity | 字串 | 實體的鏈接 |
|
|
| entityId | 字串 | 實體的唯一標識符 |
|
|
| 名稱 | 字串 | 實體的名稱 |
|
|
| 圖片URL | 字串 | 的圖片"," |
|
|
| avatarType | 頭像類型 | 您要顯示的頭像類型。 您要顯示的頭像類型。 Has two options: `rounded` and `squared` |
|
|
| 變體 | `EntityChipVariant` 枚舉 | 你要顯示的實體芯片的變體。 有兩種選擇:`常規`和`透明` |
|
|
| 左圖標 | 圖標組件 | 一個代表圖標的 React 組件。 顯示在芯片的左側 |
|
|
|
|
</Tab>
|
|
</Tabs>
|