탐색

v2.1.0
폼

태그 입력

입력한 텍스트를 값으로 바꾸어 오목한 영역 안에 칩으로 하나씩 표시하는 필드입니다.

이 페이지의 내용

태그 입력은 입력한 텍스트를 값으로 바꾸고, 각 값을 오목한 영역 안에 칩으로 표시하는 필드입니다. input-group-wrap과 tags 클래스를 적용한 입력 그룹으로 구성합니다. 오목한 영역과 그 상태, 영역과 둥근 모서리의 중심이 일치하는 칩은 모두 입력 그룹에서 제공하며, 칩 뒤에 오는 필드가 다음 값을 입력받습니다. tags 동작은 텍스트를 칩으로 바꾸고 칩 사이에서 포커스를 이동합니다.

태그 입력

<div class="field max-w(420) mx-auto">  <label for="labels">Labels</label>  <div class="tags input-group input-group-wrap">    <span class="chip" data-value="design">      design<input type="hidden" name="labels" value="design"><button type="button" class="chip-remove" tabindex="-1" aria-label="Remove design">        <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">          <path d="M4 4L12 12" /><path d="M4 12L12 4" />        </svg>      </button>    </span>    <span class="chip" data-value="research">      research<input type="hidden" name="labels" value="research"><button type="button" class="chip-remove" tabindex="-1" aria-label="Remove research">        <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">          <path d="M4 4L12 12" /><path d="M4 12L12 4" />        </svg>      </button>    </span>    <span class="chip" data-value="accessibility">      accessibility<input type="hidden" name="labels" value="accessibility"><button type="button" class="chip-remove" tabindex="-1" aria-label="Remove accessibility">        <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">          <path d="M4 4L12 12" /><path d="M4 12L12 4" />        </svg>      </button>    </span>    <input class="input-group-field" id="labels" placeholder="Add a label" autocomplete="off" aria-describedby="labels-hint">  </div>  <p class="field-hint" id="labels-hint">Press Enter or type a comma after each label.</p></div><script type="module">  import { attach } from '@master/ui/behaviors'  attach()</script>
import { useEffect, useRef } from 'react'import { attach } from '@master/ui/behaviors'import XIcon from '@master/icons-react/native/16/soft/x'export function Example() {  const root = useRef<HTMLDivElement>(null)  useEffect(() => attach(root.current!), [])  return (    <div ref={root} className="field max-w(420) mx-auto">      <label htmlFor="labels">Labels</label>      <div className="tags input-group input-group-wrap">        <span className="chip" data-value="design">          design<input type="hidden" name="labels" value="design" /><button type="button" className="chip-remove" tabIndex={-1} aria-label="Remove design">            <XIcon className="icon" />          </button>        </span>        <span className="chip" data-value="research">          research<input type="hidden" name="labels" value="research" /><button type="button" className="chip-remove" tabIndex={-1} aria-label="Remove research">            <XIcon className="icon" />          </button>        </span>        <span className="chip" data-value="accessibility">          accessibility<input type="hidden" name="labels" value="accessibility" /><button type="button" className="chip-remove" tabIndex={-1} aria-label="Remove accessibility">            <XIcon className="icon" />          </button>        </span>        <input className="input-group-field" id="labels" placeholder="Add a label" autoComplete="off" aria-describedby="labels-hint" />      </div>      <p className="field-hint" id="labels-hint">Press Enter or type a comma after each label.</p>    </div>  )}
<script>  import { attach } from '@master/ui/behaviors'  import XIcon from '@master/icons-svelte/native/16/soft/x'</script><div class="field max-w(420) mx-auto" {@attach attach}>  <label for="labels">Labels</label>  <div class="tags input-group input-group-wrap">    <span class="chip" data-value="design">      design<input type="hidden" name="labels" value="design"><button type="button" class="chip-remove" tabindex="-1" aria-label="Remove design">        <XIcon class="icon" />      </button>    </span>    <span class="chip" data-value="research">      research<input type="hidden" name="labels" value="research"><button type="button" class="chip-remove" tabindex="-1" aria-label="Remove research">        <XIcon class="icon" />      </button>    </span>    <span class="chip" data-value="accessibility">      accessibility<input type="hidden" name="labels" value="accessibility"><button type="button" class="chip-remove" tabindex="-1" aria-label="Remove accessibility">        <XIcon class="icon" />      </button>    </span>    <input class="input-group-field" id="labels" placeholder="Add a label" autocomplete="off" aria-describedby="labels-hint">  </div>  <p class="field-hint" id="labels-hint">Press Enter or type a comma after each label.</p></div>
<script setup>import { onMounted, onUnmounted, ref } from 'vue'import { attach } from '@master/ui/behaviors'import XIcon from '@master/icons-vue/native/16/soft/x'const root = ref(null)let detachonMounted(() => { detach = attach(root.value) })onUnmounted(() => detach?.())</script><template>  <div ref="root" class="field max-w(420) mx-auto">    <label for="labels">Labels</label>    <div class="tags input-group input-group-wrap">      <span class="chip" data-value="design">        design<input type="hidden" name="labels" value="design"><button type="button" class="chip-remove" tabindex="-1" aria-label="Remove design">          <XIcon class="icon" />        </button>      </span>      <span class="chip" data-value="research">        research<input type="hidden" name="labels" value="research"><button type="button" class="chip-remove" tabindex="-1" aria-label="Remove research">          <XIcon class="icon" />        </button>      </span>      <span class="chip" data-value="accessibility">        accessibility<input type="hidden" name="labels" value="accessibility"><button type="button" class="chip-remove" tabindex="-1" aria-label="Remove accessibility">          <XIcon class="icon" />        </button>      </span>      <input class="input-group-field" id="labels" placeholder="Add a label" autocomplete="off" aria-describedby="labels-hint">    </div>    <p class="field-hint" id="labels-hint">Press Enter or type a comma after each label.</p>  </div></template>
레이블을 입력하고 Enter 키를 누르세요. 빈 필드에서 Backspace 키를 누르면 마지막 레이블로 이동하고, 한 번 더 누르면 그 레이블이 삭제됩니다.

#입력 그룹에 더해지는 기능

  • 값 추가. 새 칩은 갑자기 나타나지 않고, 캐럿이 있던 자리에서 80% 크기부터 짧은 지속 시간에 걸쳐 커지며 나타납니다. 동작 줄이기 설정이 켜져 있으면 서서히 나타나기만 합니다.
  • 단어를 입력할 공간. 필드는 최소 --tags-field-min(기본값 6rem)의 너비를 유지하며, 그보다 좁아지면 아래쪽에 한 줄을 따로 차지합니다. 따라서 캐럿이 줄 끝의 좁은 틈에 끼는 일이 없습니다.
  • 키보드 포커스가 있는 값에는 칩 전체에 포커스 링이 표시됩니다. 그 상태에서 Backspace 키를 누르면 값 전체가 삭제되기 때문입니다. 삭제 버튼의 X 표시는 눌린 상태의 색조로 바뀝니다. 이 포커스 링은 칩이 그리는 것이므로, chip-remove가 있는 칩이라면 어디에 있든 표시됩니다.
  • 거부된 값이 있으면 필드에 aria-invalid="true"가 설정되고, 입력 그룹은 텍스트가 바뀔 때까지 위험 색상 테두리를 표시합니다.

@starting-style을 지원하지 않는 브라우저에서는 새 값이 바로 나타납니다.

#동작

tags 동작은 tags 클래스가 있는 입력 그룹을 루트 요소로 받아, 연결한 동작을 해제하는 함수를 반환합니다.

app.js
import { tags } from '@master/ui/behaviors/tags.js'const detach = tags(document.querySelector('.tags'), { max: 10 })
  • 추가. Enter 키나 구분 문자(기본값은 쉼표)를 입력하면 필드의 텍스트가 값이 됩니다. 필드 앞에 칩이 작성되고 필드는 비워집니다. 구분 문자, 줄바꿈, 탭이 들어 있는 텍스트를 붙여 넣으면 이를 경계로 나뉜 각 항목이 값으로 추가되며, 마지막 구분 문자 뒤의 텍스트는 필드에 남습니다.
  • 거부. 비어 있는 값, 이미 있는 값, max를 넘는 값, validate가 거부한 값은 추가되지 않습니다. 입력한 내용이 사라지지 않도록 필드는 텍스트를 그대로 유지하며, 텍스트가 바뀔 때까지 aria-invalid="true" 상태가 됩니다.
  • 삭제. 칩의 삭제 버튼을 클릭하면 칩이 삭제되고 포커스는 필드로 돌아갑니다.
  • 폼. 기존 칩에 name이 있는 숨겨진 입력 요소가 이미 들어 있거나 name 옵션을 지정하면, 각 칩에 값을 담은 숨겨진 입력 요소가 포함됩니다. 따라서 폼은 모든 값을 해당 이름으로 제출합니다. 폼을 초기화하면 필드에 처음 있던 값으로 되돌아갑니다.
  • 이벤트. 값을 추가하거나 삭제할 때마다 루트 요소에서 input과 change 이벤트를 발생시킵니다. 반환된 함수에는 값을 순서대로 담은 value가 있습니다. 이 속성에 값을 설정하면 기존 값이 대체되며, 이때는 이벤트가 발생하지 않습니다.
옵션기본값
delimiters[',']Enter 키처럼 값을 추가하는 키입니다. []로 지정하면 Enter 키만 남습니다.
max없음필드에 담을 수 있는 최대 값 개수입니다.
validate없음값을 추가할 수 있는지 판단하는 함수입니다.
name기존 칩의 숨겨진 입력 요소 이름새 칩에 포함되는 숨겨진 입력 요소의 이름입니다.
removeLabelRemove <value>페이지 언어로 지정하는 칩 삭제 버튼의 접근 가능한 이름입니다.
draw없음칩 작성을 대신 맡습니다. 자체 목록을 바탕으로 칩을 작성하는 렌더러에 사용합니다.

칩은 data-value 값을 나타내며, 이 속성이 없으면 칩의 텍스트를 값으로 사용합니다. 동작을 연결하지 않으면 필드는 일반 텍스트 입력란이 되고 칩은 고정됩니다. 이때도 폼은 칩에 포함된 숨겨진 입력 요소를 제출합니다.

#추천 항목

<datalist>를 사용하면 별도의 스크립트 없이 브라우저 자체의 추천 항목을 필드에 제공할 수 있습니다. 사용자가 추천 항목을 고른 다음 Enter 키를 눌러 값으로 추가합니다. 값을 반드시 목록에서 골라야 한다면 여러 값을 선택하는 콤보박스를 사용하세요.

추천 항목

<div class="field max-w(420) mx-auto">  <label for="recipients">Recipients</label>  <div class="tags input-group input-group-wrap">    <span class="chip" data-value="ada@example.com">      ada@example.com<input type="hidden" name="to" value="ada@example.com"><button type="button" class="chip-remove" tabindex="-1" aria-label="Remove ada@example.com">        <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">          <path d="M4 4L12 12" /><path d="M4 12L12 4" />        </svg>      </button>    </span>    <input class="input-group-field" id="recipients" type="email" list="recipient-suggestions" placeholder="Add a recipient" autocomplete="off">  </div>  <datalist id="recipient-suggestions">    <option value="grace@example.com"></option>    <option value="linus@example.com"></option>    <option value="margaret@example.com"></option>  </datalist></div><script type="module">  import { attach } from '@master/ui/behaviors'  attach()</script>
import { useEffect, useRef } from 'react'import { attach } from '@master/ui/behaviors'import XIcon from '@master/icons-react/native/16/soft/x'export function Example() {  const root = useRef<HTMLDivElement>(null)  useEffect(() => attach(root.current!), [])  return (    <div ref={root} className="field max-w(420) mx-auto">      <label htmlFor="recipients">Recipients</label>      <div className="tags input-group input-group-wrap">        <span className="chip" data-value="ada@example.com">          ada@example.com<input type="hidden" name="to" value="ada@example.com" /><button type="button" className="chip-remove" tabIndex={-1} aria-label="Remove ada@example.com">            <XIcon className="icon" />          </button>        </span>        <input className="input-group-field" id="recipients" type="email" list="recipient-suggestions" placeholder="Add a recipient" autoComplete="off" />      </div>      <datalist id="recipient-suggestions">        <option value="grace@example.com"></option>        <option value="linus@example.com"></option>        <option value="margaret@example.com"></option>      </datalist>    </div>  )}
<script>  import { attach } from '@master/ui/behaviors'  import XIcon from '@master/icons-svelte/native/16/soft/x'</script><div class="field max-w(420) mx-auto" {@attach attach}>  <label for="recipients">Recipients</label>  <div class="tags input-group input-group-wrap">    <span class="chip" data-value="ada@example.com">      ada@example.com<input type="hidden" name="to" value="ada@example.com"><button type="button" class="chip-remove" tabindex="-1" aria-label="Remove ada@example.com">        <XIcon class="icon" />      </button>    </span>    <input class="input-group-field" id="recipients" type="email" list="recipient-suggestions" placeholder="Add a recipient" autocomplete="off">  </div>  <datalist id="recipient-suggestions">    <option value="grace@example.com"></option>    <option value="linus@example.com"></option>    <option value="margaret@example.com"></option>  </datalist></div>
<script setup>import { onMounted, onUnmounted, ref } from 'vue'import { attach } from '@master/ui/behaviors'import XIcon from '@master/icons-vue/native/16/soft/x'const root = ref(null)let detachonMounted(() => { detach = attach(root.value) })onUnmounted(() => detach?.())</script><template>  <div ref="root" class="field max-w(420) mx-auto">    <label for="recipients">Recipients</label>    <div class="tags input-group input-group-wrap">      <span class="chip" data-value="ada@example.com">        ada@example.com<input type="hidden" name="to" value="ada@example.com"><button type="button" class="chip-remove" tabindex="-1" aria-label="Remove ada@example.com">          <XIcon class="icon" />        </button>      </span>      <input class="input-group-field" id="recipients" type="email" list="recipient-suggestions" placeholder="Add a recipient" autocomplete="off">    </div>    <datalist id="recipient-suggestions">      <option value="grace@example.com"></option>      <option value="linus@example.com"></option>      <option value="margaret@example.com"></option>    </datalist>  </div></template>

#키보드

탭 순서에서 멈추는 곳은 필드 하나뿐입니다. 칩에는 필드에서 이동하며, 칩의 삭제 버튼은 tabindex="-1"로 탭 순서에서 제외됩니다. 입력기로 문자를 조합하는 동안에는 입력기가 Enter 키를 처리합니다.

키동작
Enter, Comma필드의 텍스트를 값으로 바꿉니다. 빈 필드에서 누른 Enter는 폼이 처리합니다.
Backspace빈 필드에서는 마지막 값으로 이동합니다. 값에서는 해당 값을 삭제하고 이전 값으로 이동합니다.
Delete값에서는 해당 값을 삭제하고 다음 값으로 이동합니다.
ArrowLeft, ArrowRight필드의 시작 위치에서는 마지막 값으로 이동합니다. 값 사이에서는 이전 또는 다음 값으로 이동하고, 마지막 값을 지나면 필드로 돌아갑니다. 오른쪽에서 왼쪽으로 읽는 레이아웃에서는 방향이 반대입니다.
Home, End값에서는 첫 번째 값으로 이동하거나 필드로 돌아갑니다.
Escape값에서는 필드로 돌아갑니다.

#접근성

  • <label>이나 aria-label로 필드에 레이블을 지정하세요. 쉼표나 Enter 키로 값을 추가한다는 사실은 바로 알기 어려우므로, 필드 아래의 힌트로 값을 추가하는 방법을 알려 주세요.
  • 각 삭제 버튼의 이름에는 삭제할 값을 페이지 언어로 포함하세요. 동작이 작성하는 칩에는 removeLabel이 이름을 지정합니다.
  • 거부된 값은 필드에 텍스트로 남고 필드는 유효하지 않은 상태로 표시됩니다. 다른 필드와 마찬가지로 필드의 힌트나 오류 메시지로 그 이유를 알려 주세요.

#React, Svelte, Vue

tags 컴포넌트는 값을 바탕으로 칩을 작성하고, 입력한 텍스트를 값으로 바꾸는 동작을 연결합니다. npx master-ui add tags 명령을 실행해 프로젝트에 복사하세요. 컴포넌트의 구성과 사용 방법은 React, Svelte, Vue에서 확인할 수 있습니다.

ui/tags.tsx
'use client'import { useState, type ComponentProps } from 'react'import { tags } from '@master/ui/behaviors/tags.js'import { useBehavior } from './use-behavior'export interface TagsProps extends Omit<ComponentProps<'input'>, 'value' | 'defaultValue' | 'name' | 'max'> {  /** The values, in order. */  value?: string[]  defaultValue?: string[]  onValueChange?: (value: string[]) => void  /** The name each value is submitted with, in a hidden input of its chip. */  name?: string  /** How many values the field holds at most. */  max?: number  /** Keys that add a value as Enter does. `[',']` by default. */  delimiters?: string[]  /** Says whether a value may be added. */  validate?: (value: string) => boolean  /** The accessible name of a chip's remove button. `Remove <value>` by default. */  removeLabel?: (value: string) => string}/** * A tags field. Name the field with `aria-label`, or give it an `id` a label points at; every other prop of * an input goes to the field. React writes the chips from the value; the behavior turns what is typed into * values and moves focus between the chips. */export function Tags({ value, defaultValue, onValueChange, name, max, delimiters, validate, removeLabel = (text: string) => `Remove ${text}`, className, ...field }: TagsProps) {  const [shown, setShown] = useState(() => value ?? defaultValue ?? [])  // The behavior keeps the values it asked for, so the chips may be written after it has said so.  const draw = setShown  const ref = useBehavior(tags, { max, delimiters, validate, removeLabel, draw, name }, { value, defaultValue, onValueChange })  const values = value ?? shown  return (    <div className={className ? `tags input-group input-group-wrap ${className}` : 'tags input-group input-group-wrap'} ref={ref}>      {values.map(each => (        <span className="chip" data-value={each} key={each}>          {each}          {name && <input type="hidden" name={name} value={each} />}          <button type="button" className="chip-remove" tabIndex={-1} aria-label={removeLabel(each)}><svg className="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" strokeWidth="1" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M4 4L12 12" /><path d="M4 12L12 4" /></svg></button>        </span>      ))}      <input className="input-group-field" autoComplete="off" {...field} />    </div>  )}
ui/Tags.svelte
<script lang="ts" module>  import type { HTMLInputAttributes } from 'svelte/elements'  export interface TagsProps extends Omit<HTMLInputAttributes, 'value' | 'name' | 'max' | 'children'> {    /** The values, in order. Bind it, or leave it out. */    value?: string[]    onValueChange?: (value: string[]) => void    /** The name each value is submitted with, in a hidden input of its chip. */    name?: string    /** How many values the field holds at most. */    max?: number    /** Keys that add a value as Enter does. `[',']` by default. */    delimiters?: string[]    /** Says whether a value may be added. */    validate?: (value: string) => boolean    /** The accessible name of a chip's remove button. `Remove <value>` by default. */    removeLabel?: (value: string) => string  }</script><script lang="ts">  import { untrack } from 'svelte'  import { tags } from '@master/ui/behaviors/tags.js'  import { behavior } from './behavior.svelte.js'  let { value = $bindable(), onValueChange, name, max, delimiters, validate, removeLabel = (text: string) => `Remove ${text}`, class: className, ...field }: TagsProps = $props()  // The behavior asks for the chips it wants; Svelte writes them from this list.  let shown = $state(untrack(() => value) ?? [])  const attach = behavior(tags, () => ({ max, delimiters, validate, removeLabel, name, draw: (values: string[]) => { shown = values } }), {    value: () => value,    change: (next) => { value = next; onValueChange?.(next) },  })</script><!--  @component  A tags field. Name the field with `aria-label`, or give it an `id` a label points at; every other prop of  an input goes to the field.--><div class={['tags input-group input-group-wrap', className]} {@attach attach}>  {#each shown as each (each)}    <span class="chip" data-value={each}>      {each}      {#if name}<input type="hidden" {name} value={each} />{/if}      <button type="button" class="chip-remove" tabindex={-1} aria-label={removeLabel(each)}><svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 4L12 12" /><path d="M4 12L12 4" /></svg></button>    </span>  {/each}  <input class="input-group-field" autocomplete="off" {...field} /></div>
ui/Tags.vue
<script setup lang="ts">import { ref, useAttrs, useTemplateRef } from 'vue'import { tags } from '@master/ui/behaviors/tags.js'import { useBehavior } from './use-behavior'defineOptions({ inheritAttrs: false })const { name, max, delimiters, validate, removeLabel = (text: string) => `Remove ${text}` } = defineProps<{  /** The name each value is submitted with, in a hidden input of its chip. */  name?: string  /** How many values the field holds at most. */  max?: number  /** Keys that add a value as Enter does. `[',']` by default. */  delimiters?: string[]  /** Says whether a value may be added. */  validate?: (value: string) => boolean  /** The accessible name of a chip's remove button. `Remove <value>` by default. */  removeLabel?: (value: string) => string}>()/** The values, in order: `v-model`. */const model = defineModel<string[]>()/* * A tags field. Name the field with `aria-label`, or give it an `id` a label points at; every attribute but * the class goes to the field. */const attrs = useAttrs()const field = () => {  const { class: _, ...rest } = attrs  return rest}// The behavior asks for the chips it wants; Vue writes them from this list.const shown = ref<string[]>(model.value ?? [])const root = useTemplateRef<HTMLDivElement>('root')useBehavior(root, tags, () => ({ name, max, delimiters, validate, removeLabel, draw: (values: string[]) => { shown.value = values } }), model)</script><template>  <div class="tags input-group input-group-wrap" :class="$attrs.class" ref="root">    <span v-for="each in shown" :key="each" class="chip" :data-value="each">      {{ each }}      <input v-if="name" type="hidden" :name="name" :value="each">      <button type="button" class="chip-remove" tabindex="-1" :aria-label="removeLabel(each)"><svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 4L12 12" /><path d="M4 12L12 4" /></svg></button>    </span>    <input class="input-group-field" autocomplete="off" v-bind="field()">  </div></template>

#클래스

클래스설명
tagsinput-group-wrap을 적용한 입력 그룹에 지정합니다. 입력 그룹의 칩이 값이 되고 필드는 다음 값을 입력받으며, 필드는 단어 하나를 입력할 공간을 확보하다가 부족해지면 별도의 줄로 넘어갑니다.

input-group, input-group-wrap, input-group-field, 그리고 값마다 chip-remove를 포함한 chip과 함께 사용합니다.

#사용자 지정 속성

속성기본값설명
--tags-field-min6rem필드가 별도의 줄로 넘어가기 전까지 줄어들 수 있는 최소 너비

#소스

@master/ui/components/tags.css
/* * Tags: a field that turns what is typed into values, each a chip in the well. * It is an input group with input-group-wrap, so the well, its states and the concentric chips are the input * group's. What tags add is the life of a value: a new chip grows out of the place the caret stood in, the * field keeps room for a word and takes a line of its own past that, and a chip the keys are on is marked as * a whole, since Backspace there removes all of it. * The script, the tags behavior, turns the text into chips and moves focus between them; without it the field * is a text input whose chips are fixed. */@layer components.ui {  .tags {    /* The narrowest the field becomes before it wraps to a line of its own. */    --tags-field-min: 6rem;    /* The script listens on the whole well: a tap there must not flash it grey on iOS. */    -webkit-tap-highlight-color: transparent;    /* As specific as the wrapping input group's own flex for its field, and later, so this one holds. */    &.input-group-wrap .input-group-field {      flex: 1 1 var(--tags-field-min);    }    /* A value arrives: it grows from the start of the field, where it was typed, instead of appearing. */    .chip {      transform-origin: 100% 50%;      transition-property: opacity, scale;      transition-duration: var(--duration-quick);      transition-timing-function: var(--easing-glide);      @starting-style {        opacity: 0;        scale: .8;      }      @media (prefers-reduced-motion: reduce) {        transition-property: opacity;        @starting-style {          scale: 1;        }      }    }    &:dir(rtl) .chip {      transform-origin: 0 50%;    }  }}