본문으로 바로가기 본문 바로가기
WIKI 기술 지식 베이스

Chip

원문 보기 위키 갱신

칩(Chip)은 특정 속성에 할당된 하나 이상의 값을 나타내는 작은 라벨 컴포넌트예요. 제거 가능, 읽기 전용, 오버플로 칩과 칩 그룹을 지원해요. 단, 이 React 구현은 더 이상 권장되지 않는(deprecated) 컴포넌트예요.

출처: 문서

본문

Warning alert:Deprecated feature This component implementation has been deprecated in favor of a newer solution, and is no longer being maintained or enhanced. To learn more about deprecated components, visit about PatternFly.

Examples

Chip variants

칩은 제거 가능하거나 읽기 전용일 수 있어요. 오버플로 칩은 칩 그룹의 콘텐츠를 펼치거나 접는 데 사용하는 특별한 칩이에요.

Chip 1

Really long chip that goes on and on

Chip 7

Read-only chip

Chip groups

칩 그룹은 범주별로 묶을 수 있는 칩들의 집합이며, 단일 속성에 할당된 하나 이상의 값을 나타내는 데 사용해요. numChips 값을 초과하면 오버플로 칩을 사용해 추가 칩을 숨겨요.

  • Chip one

  • Really long chip that goes on and on

  • Chip three

Chip groups with categories

Category one

  • Chip one

  • Really long chip that goes on and on

  • Chip three

Chip groups with removable categories

Category one

  • Chip one

  • Chip two

  • Chip three

Category two has a very long name

  • Chip one

  • Chip two

  • Chip three

Props

Chip

*required | | Name | Type | Default | Description | badge | React.ReactNode | | Badge to add to the chip. The badge will be rendered after the chip text. | | children | React.ReactNode | | Content rendered inside the label. | | className | string | '' | Additional classes added to the label. | | closeBtn | React.ReactNode | | Node for custom close button. | | closeBtnAriaLabel | string | | Aria label for close button | | closeBtnProps | any | | Additional properties for the default close button. | | color | 'blue' | 'teal' | 'green' | 'orange' | 'purple' | 'red' | 'orangered' | 'grey' | 'yellow' | LabelColor | | Color of the label. | | Deprecated: component | React.ReactNode | | Component that will be used for chip. It is recommended that or

  • are used when the chip is an overflow chip. | | editableProps | any | | Additional props passed to the editable label text div. Optionally passing onInput and onBlur callbacks will allow finer custom text input control. | | href | string | | Href for a label that is a link. If present, the label will change to an anchor element. This should not be passed in if the onClick prop is also passed in. | | icon | React.ReactNode | | Icon added to the left of the label text. Overrides the icon set by the status property. | | isClickable | boolean | | Flag indicating the label is clickable. This flag will automatically be set if a href is passed, or if an onClick handler is passed and the label is not an overflow or add variant. This should be manually set when using the render prop. | | isCompact | boolean | | Flag indicating the label is compact. | | isDisabled | boolean | | Flag indicating the label is disabled. Works only on clickable labels, so either href or onClick props must be passed in. | | isEditable | boolean | | Flag indicating the label is editable. | | isOverflowChip | boolean | false | Flag indicating if the chip is an overflow chip | | isReadOnly | boolean | false | Flag indicating if chip is read only | | onClick | (event: React.MouseEvent) => void | (_e: React.MouseEvent) => undefined as any | Callback for when the label is clicked. This should not be passed in if the href or isEditable props are also passed in. | | onClose | (event: React.MouseEvent) => void | | Close click callback for removable labels. If present, label will have a close button. | | onEditCancel | (event: KeyboardEvent, previousText: string) => void | | Callback when an editable label cancels an edit. | | onEditComplete | (event: MouseEvent | KeyboardEvent, newText: string) => void | | Callback when an editable label completes an edit. | | ouiaId | number | string | | Value to overwrite the randomly generated data-ouia-component-id. | | ouiaSafe | boolean | | | render | ({ className, content, componentRef }: { className: string; content: React.ReactNode; componentRef: any; }) => React.ReactNode | | Forwards the label content and className to rendered function. Use this prop for react router support. | | status | 'success' | 'warning' | 'danger' | 'info' | 'custom' | | Status of the label with a respective icon and color. Overrides the color set by the color property. | | textMaxWidth | string | '16ch' | The max width of the label before it is truncated. Can be any valid CSS unit, such as '100%', '100px', or '16ch'. | | tooltipPosition | | TooltipPosition | 'auto' | 'top' | 'bottom' | 'left' | 'right' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'left-start' | 'left-end' | 'right-start' | 'right-end' | 'top' | Position of the tooltip which is displayed if text is truncated | | variant | 'outline' | 'filled' | 'overflow' | 'add' | | Variant of the label. |

    ChipGroup

    *required | | Name | Type | Default | Description | aria-label | string | 'Chip group category' | Aria label for chip group that does not have a category name | | categoryName | string | '' | Category name text for the chip group category. If this prop is supplied the chip group with have a label and category styling applied | | children | React.ReactNode | | Content rendered inside the chip group. Should be elements. | | className | string | | Additional classes added to the chip item | | closeBtnAriaLabel | string | 'Close chip group' | Aria label for close button | | collapsedText | string | '${remaining} more' | Customizable template string. Use variable "${remaining}" for the overflow chip count. | | defaultIsOpen | boolean | false | Flag for having the chip group default to expanded | | expandedText | string | 'Show Less' | Customizable "Show Less" text string | | isClosable | boolean | false | Flag if chip group can be closed | | numChips | number | 3 | Set number of chips to show before overflow | | onClick | (event: React.MouseEvent) => void | | Function that is called when clicking on the chip group close button or on an overflow chip | | Deprecated: onOverflowChipClick | (event: React.MouseEvent) => void | | Function that is called when clicking on the overflow (expand/collapse) chip button | | ouiaId | number | string | | Value to overwrite the randomly generated data-ouia-component-id. | | ouiaSafe | boolean | | | tooltipPosition | | TooltipPosition | 'auto' | 'top' | 'bottom' | 'left' | 'right' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'left-start' | 'left-end' | 'right-start' | 'right-end' | 'top' | Position of the tooltip which is displayed if the category name text is longer |

    Edit this page on GitHub

    더 알아보기 (Learn more)