--- title: Indicator description: "`Indicator`は、アバターなどの要素の隅に表示するコンポーネントです。" links: - style: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/indicator/indicator.style.ts - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/indicator - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/components-indicator--basic --- ```tsx ``` ## 使い方 ```tsx import { Indicator } from "@yamada-ui/react" ``` ```tsx import { Indicator } from "@/components/ui" ``` ```tsx import { Indicator } from "@workspaces/ui" ``` ```tsx ``` ### バリアントを変更する ```tsx {(variant, index) => ( )} ``` ### サイズを変更する ```tsx {(size, index) => ( )} ``` ### カラースキームを変更する ```tsx {(colorScheme, index) => ( )} ``` ### 表示位置を変更する 表示位置を変更する場合は、`placement`に`start-start`や`center-end`などを指定します。 ```tsx const placements = [ "start-start", "start-center", "start-end", "center-start", "center-center", "center-end", "end-start", "end-center", "end-end", ] as const return ( {(placement, index) => ( )} ) ``` ### オフセットを変更する オフセットを変更する場合は、`offset`に値を設定します。 ```tsx ``` ### 最大値を設定する 最大値を設定する場合は、`overflowCount`に数値を設定します。 ```tsx ``` ### ゼロを表示しない ゼロを表示しない場合は、`showZero`を`false`にします。 ```tsx ``` ### 境界線を表示する 境界線を表示する場合は、`withBorder`を`true`にします。 ```tsx ``` ### ハイライトする ハイライトする場合は、`ping`プロパティを使用します。 ```tsx ``` ### 非表示にする 非表示にする場合は、`disabled`を`true`にします。 ```tsx ``` ## Props | Prop | Default | Type | Description | | --------------- | ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | | `size` | - | `"lg" \| "md" \| "sm"` | The size of the component. | | `variant` | - | `"solid" \| "subtle" \| "surface"` | The variant of the component. | | `disabled` | `false` | `boolean` | If `true`, the indicator will be disabled. | | `floatProps` | - | `IndicatorFloatProps` | Props for the float element. | | `inline` | `false` | `boolean` | If `true`, set the indicator as an inline element. | | `label` | - | `ReactNode` | The indicator label to use. | | `labelProps` | - | `IndicatorLabelProps` | Props for the label element. | | `offset` | - | `"-0.5" \| "-1.5" \| "-1" \| "-10" \| "-11" \| "-12" \| "-13" \| "-14" \| "-15" \| "-16" ...` | Changes position offset. | | `overflowCount` | `99` | `number` | If `label` is of type number, the maximum number displayed. | | `ping` | `false` | `boolean \| PingOptions` | If `true`, make an element scale and fade like a radar ping or ripple of water. | | `placement` | `"start-end"` | `"center-center" \| "center-end" \| "center-start" \| "center" \| "end-center" \| "end-end" \| "end-start" \| "end" \| "start-center" \| "start-end" ...` | The placement of the float. | | `showZero` | `true` | `boolean` | If `true`, display 0. | | `withBorder` | `false` | `boolean` | If `true`, display the border of the indicator. |