Icon Button
익숙한 아이콘으로 공간을 적게 쓰면서 행동을 실행합니다.
기본 예제
코드 접기
<script> import { DsIconButton, DsSearchField, DsTheme } from '@conalog/ds-svelte'; import { SearchOutlined } from '@conalog/ds-svelte/icons';
let searchOpen = $state(false); let searchQuery = $state('');</script>
<DsTheme theme="light"> <div class="sample"> <div class="toolbar"> <strong>발전소 목록</strong> <DsIconButton label={searchOpen ? '발전소 검색 닫기' : '발전소 검색 전환'} icon={SearchOutlined} onclick={() => searchOpen = !searchOpen} /> </div> {#if searchOpen} <DsSearchField label="발전소 검색" placeholder="발전소 이름" bind:value={searchQuery} /> {/if} </div></DsTheme>
<style> .sample { display: grid; gap: var(--site-item-gap, 0.5rem); inline-size: min(100%, 20rem); margin-inline: auto; } .toolbar { display: flex; align-items: center; justify-content: space-between; gap: var(--site-card-padding, 1rem); } strong { font-size: var(--site-size-body, 0.8125rem); }</style><script> import { DsIconButton, DsSearchField, DsTheme } from '@conalog/ds-svelte'; import { SearchOutlined } from '@conalog/ds-svelte/icons';
let searchOpen = $state(false); let searchQuery = $state('');</script>
<DsTheme theme="light"> <div class="sample"> <div class="toolbar"> <strong>발전소 목록</strong> <DsIconButton label={searchOpen ? '발전소 검색 닫기' : '발전소 검색 전환'} icon={SearchOutlined} onclick={() => searchOpen = !searchOpen} />코드 접기
import 'package:conalog_ds_flutter/conalog_ds_flutter.dart';import 'package:conalog_ds_flutter/icons/search.dart';import 'package:flutter/material.dart';
Widget buildExample(BuildContext context) => const _SearchButton();
class _SearchButton extends StatefulWidget { const _SearchButton();
@override State<_SearchButton> createState() => _SearchButtonState();}
class _SearchButtonState extends State<_SearchButton> { final _query = TextEditingController(); bool _open = false;
@override Widget build(BuildContext context) => Center( child: ConstrainedBox( constraints: const BoxConstraints(maxWidth: 320), child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.stretch, spacing: 8, children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ const Text('발전소 목록'), DsIconButton( label: '발전소 검색 전환', icon: dsIconSearch, onPressed: () => setState(() => _open = !_open), ), ], ), if (_open) DsSearchField( label: '발전소 검색', placeholder: '발전소 이름', controller: _query, searchIcon: dsIconSearch, ), ], ), ), );
@override void dispose() { _query.dispose(); super.dispose(); }}import 'package:conalog_ds_flutter/conalog_ds_flutter.dart';import 'package:conalog_ds_flutter/icons/search.dart';import 'package:flutter/material.dart';
Widget buildExample(BuildContext context) => const _SearchButton();
class _SearchButton extends StatefulWidget { const _SearchButton();
@override State<_SearchButton> createState() => _SearchButtonState();}
class _SearchButtonState extends State<_SearchButton> {아이콘의 모양 대신 행동을 접근성 이름으로 붙입니다. 의미가 명확하지 않거나 중요한 행동에는 Action Button을 사용합니다.
변형과 상태
형태
검색 아이콘에 약한 채움, 테두리, 면 강조, 전경 강조를 적용합니다.
weakoutlineclearquiet코드 접기
<script> import { DsIconButton, DsTheme } from '@conalog/ds-svelte'; import { SearchOutlined } from '@conalog/ds-svelte/icons';
const values = ['weak', 'outline', 'clear', 'quiet']; let activated = $state('');</script>
<DsTheme theme="light"> <div class="samples"> {#each values as value (value)} <figure> <div class="target"> <DsIconButton label={'검색 (' + value + ')'} icon={SearchOutlined} variant={value} onclick={() => activated = value} /> </div> <figcaption><code>{value}</code></figcaption> </figure> {/each} </div> <p role="status">{activated && activated + ' 예제를 실행했습니다.'}</p></DsTheme>
<style> .samples { display: flex; flex-wrap: wrap; align-items: start; gap: 0.75rem 1rem; } figure { display: grid; justify-items: center; gap: 0.25rem; min-inline-size: 3rem; margin: 0; } .target { display: grid; min-block-size: 2.75rem; place-items: center; } figcaption { font-size: 0.8125rem; } p { margin-block: 0.5rem 0; } p:empty { margin: 0; }</style>크기
같은 검색 아이콘으로 xs부터 lg까지 버튼 크기를 비교합니다.
xssmmdlg코드 접기
<script> import { DsIconButton, DsTheme } from '@conalog/ds-svelte'; import { SearchOutlined } from '@conalog/ds-svelte/icons';
const values = ['xs', 'sm', 'md', 'lg']; let activated = $state('');</script>
<DsTheme theme="light"> <div class="samples"> {#each values as value (value)} <figure> <div class="target"> <DsIconButton label={'검색 (' + value + ')'} icon={SearchOutlined} size={value} onclick={() => activated = value} /> </div> <figcaption><code>{value}</code></figcaption> </figure> {/each} </div> <p role="status">{activated && activated + ' 예제를 실행했습니다.'}</p></DsTheme>
<style> .samples { display: flex; flex-wrap: wrap; align-items: start; gap: 0.75rem 1rem; } figure { display: grid; justify-items: center; gap: 0.25rem; min-inline-size: 3rem; margin: 0; } .target { display: grid; min-block-size: 2.75rem; place-items: center; } figcaption { font-size: 0.8125rem; } p { margin-block: 0.5rem 0; } p:empty { margin: 0; }</style>색상
아이콘은 유지하고 주요, 중립, 위험 역할의 색을 바꿉니다.
primaryneutralcritical코드 접기
<script> import { DsIconButton, DsTheme } from '@conalog/ds-svelte'; import { SearchOutlined } from '@conalog/ds-svelte/icons';
const values = ['primary', 'neutral', 'critical']; let activated = $state('');</script>
<DsTheme theme="light"> <div class="samples"> {#each values as value (value)} <figure> <div class="target"> <DsIconButton label={'검색 (' + value + ')'} icon={SearchOutlined} color={value} onclick={() => activated = value} /> </div> <figcaption><code>{value}</code></figcaption> </figure> {/each} </div> <p role="status">{activated && activated + ' 예제를 실행했습니다.'}</p></DsTheme>
<style> .samples { display: flex; flex-wrap: wrap; align-items: start; gap: 0.75rem 1rem; } figure { display: grid; justify-items: center; gap: 0.25rem; min-inline-size: 3rem; margin: 0; } .target { display: grid; min-block-size: 2.75rem; place-items: center; } figcaption { font-size: 0.8125rem; } p { margin-block: 0.5rem 0; } p:empty { margin: 0; }</style>상태
활성, 비활성, 로딩에서 클릭과 아이콘 표시가 어떻게 달라지는지 확인합니다.
enableddisabledloading코드 접기
<script> import { DsIconButton, DsTheme } from '@conalog/ds-svelte'; import { SearchOutlined } from '@conalog/ds-svelte/icons';
const values = ['enabled', 'disabled', 'loading']; let activated = $state('');</script>
<DsTheme theme="light"> <div class="samples"> {#each values as value (value)} <figure> <div class="target"> <DsIconButton label={'검색 (' + value + ')'} icon={SearchOutlined} presentation={value} onclick={() => activated = value} /> </div> <figcaption><code>{value}</code></figcaption> </figure> {/each} </div> <p role="status">{activated && activated + ' 예제를 실행했습니다.'}</p></DsTheme>
<style> .samples { display: flex; flex-wrap: wrap; align-items: start; gap: 0.75rem 1rem; } figure { display: grid; justify-items: center; gap: 0.25rem; min-inline-size: 3rem; margin: 0; } .target { display: grid; min-block-size: 2.75rem; place-items: center; } figcaption { font-size: 0.8125rem; } p { margin-block: 0.5rem 0; } p:empty { margin: 0; }</style>직접 조합해 보기
형태, 색상, 크기, 상태를 독립적으로 바꿉니다.
미리보기
ButtonPlayground.svelte
세 파일을 같은 폴더에 저장합니다. <ButtonPlayground kind="icon" />으로 호출합니다.
<script> import { DsActionButton, DsIconButton } from '@conalog/ds-svelte'; import { CheckFilled, SearchOutlined } from '@conalog/ds-svelte/icons'; import PlaygroundLayout from './PlaygroundLayout.svelte';
// Set kind="icon" to preview the Icon Button. let { kind = 'action' } = $props(); const sizeField = { key: 'size', label: '크기', segmented: true, options: ['xs', 'sm', 'md', 'lg'].map(value => ({ value, label: value })), }; const color = { key: 'color', label: '색상', options: [ { value: 'primary', label: '주요' }, { value: 'neutral', label: '중립' }, { value: 'critical', label: '위험' }, ], }; const stateField = { key: 'state', label: '상태', options: [ { value: 'enabled', label: '활성' }, { value: 'disabled', label: '비활성' }, { value: 'loading', label: '로딩' }, ], }; const placement = { key: 'placement', label: '아이콘 위치', options: [ { value: 'none', label: '없음' }, { value: 'prefix', label: '앞' }, { value: 'suffix', label: '뒤' }, ], }; let action = $derived(kind === 'action'); let fields = $derived([ sizeField, { key: 'variant', label: '형태', options: [ ...(action ? [{ value: 'solid', label: '채움' }] : []), { value: 'weak', label: '약한 채움' }, { value: 'outline', label: '외곽선' }, { value: 'clear', label: '면 강조' }, { value: 'quiet', label: '전경 강조' }, ], }, values.variant === 'quiet' ? { ...color, options: color.options.filter(option => option.value === 'neutral') } : color, stateField, ...(action ? [placement] : []), ]); let defaults = $derived({ size: 'md', variant: action ? 'solid' : 'weak', color: action ? 'primary' : 'neutral', state: 'enabled', placement: 'none', }); let selection = $state({}); let activations = $state(0); let values = $derived.by(() => { const options = { ...defaults, ...selection }; return options.variant === 'quiet' ? { ...options, color: 'neutral' } : options; }); let feedback = $derived(values.state === 'disabled' ? '비활성 상태' : values.state === 'loading' ? '처리 중' : activations ? `버튼 실행 ${activations}회` : '');
function reset() { selection = {}; activations = 0; }</script>
<PlaygroundLayout title="버튼 옵션" {fields} {values} onchange={(key, value) => selection[key] = value} onreset={reset}> <div class="button-preview" data-button-preview> {#if action} <DsActionButton label="변경 저장" icon={values.placement === 'none' ? undefined : CheckFilled} iconPosition={values.placement === 'suffix' ? 'suffix' : 'prefix'} variant={values.variant} size={values.size} color={values.color} presentation={values.state} onclick={() => activations++} /> {:else} <DsIconButton label="검색" icon={SearchOutlined} variant={values.variant} size={values.size} color={values.color} presentation={values.state} onclick={() => activations++} /> {/if} <p role="status">{feedback}</p> </div></PlaygroundLayout>
<style> .button-preview { display: grid; justify-items: center; gap: var(--workbench-gap); } p { min-block-size: 1lh; margin: 0; font: var(--workbench-support); color: var(--workbench-muted); }</style> PlaygroundLayout.svelte
<script> import { getTokens } from '@conalog/ds-core'; import { DsActionButton, DsSegmentedControl, DsTheme } from '@conalog/ds-svelte'; import NativeSelect from './NativeSelect.svelte';
let { title = '옵션', fields, values, onchange, onreset, wide = false, children } = $props(); const instance = $props.id(); const tokens = getTokens('light'); const token = id => tokens[id].$value; const font = id => { const text = token(id); return `${text['font-weight']} ${text['font-size']}/${text['line-height']} ${text['font-family']}`; };</script>
<DsTheme theme="light"> <div class="workbench" style:--workbench-body={font('type.body')} style:--workbench-title={font('type.title')} style:--workbench-support={font('type.sub')} style:--workbench-ink={token('fg.neutral-contrast')} style:--workbench-muted={token('fg.neutral')} style:--workbench-canvas={token('bg.layer-basement')} style:--workbench-paper={token('bg.layer-floating')} style:--workbench-border={token('stroke.neutral')} style:--workbench-radius={token('radius.r2-5')} style:--workbench-padding={token('spacing.card-edge')} style:--workbench-gap={token('spacing-y.between-blocks')} style:--workbench-field-gap={token('spacing-y.between-text')}> <div class="layout"> <section class="preview" aria-labelledby={instance + '-preview'}> <h4 id={instance + '-preview'}>미리보기</h4> <div class={['stage', { wide }]}> {@render children()} </div> </section> <section class="options" aria-labelledby={instance + '-options'}> <header> <h4 id={instance + '-options'}>{title}</h4> <DsActionButton label="초기화" color="neutral" variant="clear" size="sm" onclick={onreset} /> </header> <div class="fields"> {#each fields as { key, label, options, segmented } (key)} <div class={['field', { segmented }]}> {#if segmented} <span>{label}</span> <DsSegmentedControl {label} items={options.map(option => ({ id: option.value, label: option.label }))} selected={values[key]} onchange={value => onchange(key, value)} size="md" /> {:else} <label for={instance + '-' + key}>{label}</label> <NativeSelect id={instance + '-' + key} name={key} {options} value={values[key]} onchange={event => onchange(key, event.currentTarget.value)} /> {/if} </div> {/each} </div> </section> </div> </div></DsTheme>
<style> .workbench { container-type: inline-size; color: var(--workbench-ink); font: var(--workbench-body); } .layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--workbench-padding); } .preview, .options { min-inline-size: 0; padding: var(--workbench-padding); border: 1px solid var(--workbench-border); border-radius: var(--workbench-radius); } .preview { display: grid; grid-template-rows: auto 1fr; background: var(--workbench-canvas); } .stage { display: grid; align-content: center; justify-items: center; gap: var(--workbench-gap); min-block-size: 7rem; } h4 { margin: 0; font: var(--workbench-title); } .stage.wide { justify-items: stretch; } header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--workbench-gap); margin-block-end: var(--workbench-gap); } .fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--workbench-gap); } .field { display: grid; align-content: start; gap: var(--workbench-field-gap); min-inline-size: 0; } .field.segmented { grid-column: 1 / -1; justify-items: start; } label, .field > span { font: var(--workbench-title); } @container (min-width: 34rem) { .layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); } }</style> NativeSelect.svelte
<script> import { getTokens } from '@conalog/ds-core';
// Adapted from shadcn-svelte Native Select to use the site's design tokens. // https://shadcn-svelte.com/docs/components/native-select let { options, value = $bindable(), docs = false, ...attributes } = $props(); const tokens = getTokens('light'); const token = id => tokens[id].$value; const text = token('type.body'); const font = `${text['font-weight']} ${text['font-size']}/${text['line-height']} ${text['font-family']}`;</script>
<div data-slot="native-select-wrapper" class={{ docs }} style:--select-font={font} style:--select-bg={token('bg.layer-floating')} style:--select-hover={token('bg.layer-default-pressed')} style:--select-color={token('fg.neutral-contrast')} style:--select-border={token('gray.300')} style:--select-ring={token('stroke.neutral-focused')} style:--select-radius={token('radius.r2')} style:--select-shadow={token('shadow.s2')} style:--select-height={token('dimension.x9')} style:--select-touch-height={token('dimension.x11')} style:--select-padding={token('dimension.x2-5')} style:--select-icon-size={token('dimension.x1-5')} style:--select-menu-gap={token('dimension.x1')}> <select {...attributes} data-slot="native-select" bind:value> {#each options as option (option.value)} <option value={option.value} disabled={option.disabled}>{option.label}</option> {/each} </select> <span data-slot="native-select-icon" aria-hidden="true"></span></div>
<style> div { position: relative; min-inline-size: 0; } div.docs { --control-bg: var(--site-overlay); --control-hover: var(--site-inset); --control-color: var(--site-ink); --control-border: var(--site-line-strong); --control-ring: var(--site-accent); } select { appearance: none; display: block; min-block-size: var(--select-height); inline-size: 100%; border: 1px solid var(--control-border, var(--select-border)); border-radius: var(--select-radius); padding-inline: var(--select-padding) calc(var(--select-padding) * 3); background: var(--control-bg, var(--select-bg)); color: var(--control-color, var(--select-color)); font: var(--select-font); cursor: pointer; } select:enabled:hover { border-color: var(--control-ring, var(--select-ring)); } select:focus-visible { outline: 2px solid var(--control-ring, var(--select-ring)); outline-offset: 2px; } select:disabled { cursor: not-allowed; opacity: 0.6; } span { position: absolute; inset-inline-end: var(--select-padding); inset-block-start: 50%; inline-size: var(--select-icon-size); block-size: var(--select-icon-size); border: solid var(--control-ring, var(--select-ring)); border-width: 0 1.5px 1.5px 0; transform: translateY(-75%) rotate(45deg); pointer-events: none; } @supports (appearance: base-select) and selector(::picker(select)) { select, select::picker(select) { appearance: base-select; } select { display: flex; align-items: center; } select::picker-icon { display: none; } select::picker(select) { margin-block: var(--select-menu-gap); border: 1px solid var(--control-border, var(--select-border)); border-radius: var(--select-radius); padding: var(--select-menu-gap); background: var(--control-bg, var(--select-bg)); color: var(--control-color, var(--select-color)); font: var(--select-font); box-shadow: var(--select-shadow); } option { padding: var(--select-menu-gap) var(--select-padding); border-radius: var(--select-menu-gap); } option:is(:hover, :focus-visible, :checked) { background: var(--control-hover, var(--select-hover)); } } @media (pointer: coarse) { select { min-block-size: var(--select-touch-height); } }</style>형태
검색 아이콘에 약한 채움, 테두리, 면 강조, 전경 강조를 적용합니다.
코드 접기
import 'package:conalog_ds_flutter/conalog_ds_flutter.dart';import 'package:conalog_ds_flutter/icons/search.dart';import 'package:flutter/material.dart';
Widget buildExample(BuildContext context) => const _Comparison();
class _Comparison extends StatefulWidget { const _Comparison();
@override State<_Comparison> createState() => _ComparisonState();}
class _ComparisonState extends State<_Comparison> { DsIconButtonVariant? _selected;
@override Widget build(BuildContext context) => Column( mainAxisSize: MainAxisSize.min, spacing: 8, children: [ Wrap( alignment: WrapAlignment.center, crossAxisAlignment: WrapCrossAlignment.center, spacing: 12, runSpacing: 12, children: [ for (final option in DsIconButtonVariant.values) Column( mainAxisSize: MainAxisSize.min, spacing: 4, children: [ DsIconButton( label: '검색 ${option.name}', icon: dsIconSearch, variant: option, onPressed: () => setState(() => _selected = option), ), Text( option.name, style: Theme.of(context).textTheme.labelSmall, ), ], ), ], ), if (_selected case final selected?) Semantics( liveRegion: true, child: Text('${selected.name} 예제를 실행했습니다.'), ), ], );}크기
같은 검색 행동을 네 가지 크기로 표시합니다.
코드 접기
import 'package:conalog_ds_flutter/conalog_ds_flutter.dart';import 'package:conalog_ds_flutter/icons/search.dart';import 'package:flutter/material.dart';
Widget buildExample(BuildContext context) => const _Comparison();
class _Comparison extends StatefulWidget { const _Comparison();
@override State<_Comparison> createState() => _ComparisonState();}
class _ComparisonState extends State<_Comparison> { DsButtonSize? _selected;
@override Widget build(BuildContext context) => Column( mainAxisSize: MainAxisSize.min, spacing: 8, children: [ Wrap( alignment: WrapAlignment.center, crossAxisAlignment: WrapCrossAlignment.center, spacing: 12, runSpacing: 12, children: [ for (final option in DsButtonSize.values) Column( mainAxisSize: MainAxisSize.min, spacing: 4, children: [ DsIconButton( label: '검색 ${option.name}', icon: dsIconSearch, size: option, onPressed: () => setState(() => _selected = option), ), Text( option.name, style: Theme.of(context).textTheme.labelSmall, ), ], ), ], ), if (_selected case final selected?) Semantics( liveRegion: true, child: Text('${selected.name} 예제를 실행했습니다.'), ), ], );}색상
같은 아이콘의 강조, 기본, 경고 색을 비교합니다.
코드 접기
import 'package:conalog_ds_flutter/conalog_ds_flutter.dart';import 'package:conalog_ds_flutter/icons/search.dart';import 'package:flutter/material.dart';
Widget buildExample(BuildContext context) => const _Comparison();
class _Comparison extends StatefulWidget { const _Comparison();
@override State<_Comparison> createState() => _ComparisonState();}
class _ComparisonState extends State<_Comparison> { DsButtonColor? _selected;
@override Widget build(BuildContext context) => Column( mainAxisSize: MainAxisSize.min, spacing: 8, children: [ Wrap( alignment: WrapAlignment.center, crossAxisAlignment: WrapCrossAlignment.center, spacing: 12, runSpacing: 12, children: [ for (final option in DsButtonColor.values) Column( mainAxisSize: MainAxisSize.min, spacing: 4, children: [ DsIconButton( label: '검색 ${option.name}', icon: dsIconSearch, color: option, onPressed: () => setState(() => _selected = option), ), Text( option.name, style: Theme.of(context).textTheme.labelSmall, ), ], ), ], ), if (_selected case final selected?) Semantics( liveRegion: true, child: Text('${selected.name} 예제를 실행했습니다.'), ), ], );}상태
활성, 비활성, 처리 중에 아이콘 버튼이 어떻게 달라지는지 확인합니다.
코드 접기
import 'package:conalog_ds_flutter/conalog_ds_flutter.dart';import 'package:conalog_ds_flutter/icons/search.dart';import 'package:flutter/material.dart';
Widget buildExample(BuildContext context) => const _Comparison();
class _Comparison extends StatefulWidget { const _Comparison();
@override State<_Comparison> createState() => _ComparisonState();}
class _ComparisonState extends State<_Comparison> { DsButtonPresentation? _selected;
String _caption(DsButtonPresentation value) => switch (value) { DsButtonPresentation.enabled => '활성', DsButtonPresentation.disabled => '비활성', DsButtonPresentation.loading => '로딩', };
@override Widget build(BuildContext context) => Column( mainAxisSize: MainAxisSize.min, spacing: 8, children: [ Wrap( alignment: WrapAlignment.center, crossAxisAlignment: WrapCrossAlignment.center, spacing: 12, runSpacing: 12, children: [ for (final option in DsButtonPresentation.values) Column( mainAxisSize: MainAxisSize.min, spacing: 4, children: [ DsIconButton( label: '검색 ${_caption(option)}', icon: dsIconSearch, presentation: option, onPressed: option == DsButtonPresentation.disabled ? null : () => setState(() => _selected = option), ), Text( _caption(option), style: Theme.of(context).textTheme.labelSmall, ), ], ), ], ), if (_selected case final selected?) Semantics( liveRegion: true, child: Text('${_caption(selected)} 예제를 실행했습니다.'), ), ], );}직접 조합해 보기
형태, 크기, 색상과 상태를 바꾸고 아이콘 버튼을 실행합니다.
button_icon/playground.dart
button_icon/playground.dart과 playground_layout.dart의 폴더 관계를 유지하고, 화면에서 buildExample을 호출합니다.
import 'package:conalog_ds_flutter/conalog_ds_flutter.dart';import 'package:flutter/material.dart';import '../playground_layout.dart';import 'package:conalog_ds_flutter/icons/search.dart';
Widget buildExample(BuildContext context) => const _Playground();
class _Playground extends StatefulWidget { const _Playground(); @override State<_Playground> createState() => _PlaygroundState();}
class _PlaygroundState extends State<_Playground> { DsButtonSize size = DsButtonSize.md; DsButtonColor color = DsButtonColor.neutral; DsIconButtonVariant variant = DsIconButtonVariant.weak; DsButtonPresentation state = DsButtonPresentation.enabled; int presses = 0; void _reset() => setState(() { size = DsButtonSize.md; color = DsButtonColor.neutral; variant = DsIconButtonVariant.weak; state = DsButtonPresentation.enabled; presses = 0; }); @override Widget build(BuildContext context) => PlaygroundLayout( onReset: _reset, preview: Column( mainAxisSize: MainAxisSize.min, spacing: 8, children: [ DsIconButton( label: '검색', icon: dsIconSearch, size: size, color: color, variant: variant, presentation: state, onPressed: state == DsButtonPresentation.disabled ? null : () => setState(() => presses++), ), Text('실행 횟수: $presses'), ], ), options: [ PlaygroundOptions<DsButtonSize>( label: '크기', segmented: true, values: DsButtonSize.values, selected: size, caption: (v) => v.name, onChanged: (v) => setState(() => size = v), ), PlaygroundOptions<DsButtonColor>( label: '색상', values: variant == DsIconButtonVariant.quiet ? const [DsButtonColor.neutral] : DsButtonColor.values, selected: color, caption: (v) => switch (v) { DsButtonColor.primary => '주요', DsButtonColor.neutral => '중립', DsButtonColor.critical => '위험', }, onChanged: (v) => setState(() => color = v), ), PlaygroundOptions<DsIconButtonVariant>( label: '형태', values: DsIconButtonVariant.values, selected: variant, caption: (v) => switch (v) { DsIconButtonVariant.weak => '약한 채움', DsIconButtonVariant.outline => '외곽선', DsIconButtonVariant.clear => '면 강조', DsIconButtonVariant.quiet => '전경 강조', }, onChanged: (v) => setState(() { variant = v; if (v == DsIconButtonVariant.quiet) color = DsButtonColor.neutral; }), ), PlaygroundOptions<DsButtonPresentation>( label: '상태', values: DsButtonPresentation.values, selected: state, caption: (v) => switch (v) { DsButtonPresentation.enabled => '활성', DsButtonPresentation.disabled => '비활성', DsButtonPresentation.loading => '로딩', }, onChanged: (v) => setState(() => state = v), ), ], );} playground_layout.dart
import 'package:conalog_ds_flutter/conalog_ds_flutter.dart';import 'package:flutter/material.dart';
/// Shared responsive layout and option picker for the documentation examples.class PlaygroundLayout extends StatelessWidget { const PlaygroundLayout({ super.key, required this.preview, required this.options, required this.onReset, }); final Widget preview; final List<PlaygroundOptions<Object?>> options; final VoidCallback onReset;
@override Widget build(BuildContext context) { final previewPanel = DsCard( heading: '미리보기', child: Padding( padding: const EdgeInsets.symmetric(vertical: 16), child: Center(child: preview), ), ); final optionPanel = DsCard( heading: '옵션', actions: DsActionButton( label: '초기화', color: DsButtonColor.neutral, size: DsButtonSize.xs, variant: DsButtonVariant.clear, onPressed: onReset, ), child: LayoutBuilder( builder: (context, constraints) { final columnWidth = (constraints.maxWidth - 12) / 2; return Wrap( spacing: 12, runSpacing: 12, children: [ for (final option in options) SizedBox( width: option.segmented ? constraints.maxWidth : columnWidth, child: option, ), ], ); }, ), ); return LayoutBuilder( builder: (context, constraints) => constraints.maxWidth >= 600 ? Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ Expanded(child: previewPanel), const SizedBox(width: 24), Expanded(child: optionPanel), ], ) : Column( crossAxisAlignment: CrossAxisAlignment.stretch, mainAxisSize: MainAxisSize.min, spacing: 20, children: [previewPanel, optionPanel], ), ); }}
class PlaygroundOptions<T> extends StatelessWidget { const PlaygroundOptions({ super.key, required this.label, required this.values, required this.selected, required this.onChanged, required this.caption, this.segmented = false, }); final String label; final List<T> values; final T selected; final ValueChanged<T> onChanged; final String Function(T) caption; final bool segmented;
@override Widget build(BuildContext context) => Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, spacing: 6, children: [ ExcludeSemantics( child: Text(label, style: Theme.of(context).textTheme.labelLarge), ), if (segmented) DsSegmentedControl( label: label, labels: values.map(caption).toList(), selectedIndex: values.indexOf(selected), onChanged: (index) => onChanged(values[index]), size: DsSegmentedControlSize.xs, ) else DsMenu( matchTriggerWidth: true, triggerBuilder: (context, toggle, open, focusNode) => MergeSemantics( child: Semantics( label: '$label, ${caption(selected)}', expanded: open, child: SizedBox( width: double.infinity, child: TextButton( focusNode: focusNode, onPressed: toggle, style: TextButton.styleFrom( padding: const EdgeInsets.symmetric(horizontal: 8), minimumSize: const Size(0, 36), shape: RoundedRectangleBorder( side: BorderSide( color: Theme.of(context).colorScheme.outlineVariant, ), borderRadius: BorderRadius.circular(6), ), ), child: ExcludeSemantics( child: Row( children: [ Expanded( child: Text( caption(selected), maxLines: 1, overflow: TextOverflow.ellipsis, ), ), const Icon(Icons.arrow_drop_down, size: 18), ], ), ), ), ), ), ), groups: [ DsMenuGroup( items: [ for (final value in values) DsMenuItem( label: caption(value), kind: DsMenuItemKind.radio, selected: value == selected, onPressed: () => onChanged(value), ), ], ), ], ), ], );}디자인 규칙
- 설계
- 설계 초안 웹 · 앱 / 화면
- 구현
- 실험 구현Svelte · Flutter
구조 미리보기
빠른 참조
공개 API
-
DsIconButton
옵션
| 이름 | 계약 선택지 | 기본값 |
|---|---|---|
color |
| neutral |
variant |
| weak |
size |
| md |
구성 요소
container- 버튼 표면과 일반 경계 및 포커스 외곽선
icon- 행동 아이콘
spinner- Loading 시 라벨 또는 아이콘 자리를 대체하는 피드백
hitArea- 시각 영역과 별도로 확보하는 최소 입력 영역
상태
hoveredpressedfocuseddisabledloading
상세 설계
계약 의존성
Button 공통 계약과 Icon Button의 세부 규칙을 함께 적용합니다. 공개 옵션과 부위·상태는 계약 JSON에서 확인합니다. 색상과 상태별 토큰은 시각 매핑, 구현 검증 기준은 적합성 확인 조건을 참고합니다.
아이콘과 입력 영역
-
컨테이너 — 정사각 면(또는 투명)과 radius. 터치 영역을 소유합니다.
-
아이콘 — 행동을 나타내는 단 하나의 그림.
iconography.md의 선택 규칙을 따릅니다(개념이 정확한 것, 같은 개념에 두 아이콘 금지).
-
라벨이 없으므로 접근성 이름이 필수입니다. web에서는
aria-label, app에서는 해당 네이티브 접근성 이름 API로 전달합니다. -
여백은 버튼이 만듭니다 — 아이콘을 키우지 않습니다(
iconography.md히트 영역 규칙). -
아이콘 색은 variant의 전경색을 따릅니다(web:
currentColor).
형태와 색상 조합
Icon Button은 neutral·primary·critical 색 묶음과 weak·outline·clear 표현을 제공합니다. 상시 보조 행동에는 neutral 전용 quiet을 사용할 수 있습니다. 주 행동을 강하게 강조하려면 라벨이 있는 Action Button을 사용합니다. 상시 보조 행동
즐겨찾기 토글 옆의 primary weak와 행 삭제의 critical weak처럼 행동의 맥락에 맞는 의미 색 묶음을 사용합니다.
-
Enabled 기본값: neutral weak와 아이콘
fg.neutral-muted를 사용합니다. -
Enabled 전경 예외: neutral의 weak·outline·clear는 Action Button의 본문 전경 대신 muted를 사용합니다. primary·critical은 명시된 해당 variant 전경을 사용합니다. Disabled에서는 시각 매핑의
fg.disabled를 사용합니다. -
의도: neutral Icon Button의 hover 피드백은 아이콘보다 면으로 전달합니다.
-
강하게 강조해야 하는 주 행동에는 라벨이 있는 Action Button solid를 사용합니다.
-
근거: 아이콘만으로는 라벨만큼 행동을 명확히 전달하기 어렵습니다.
-
주목도 순서는 outline > weak > clear > quiet입니다 — 반복·밀집 환경에서는 테두리가 연한 면보다 또렷하다는 배지의 역전과 같은 순서입니다(
variants.md의 일반 위계와 다른 지점). outline은 단독 배치에서 눈에 띄어야 할 때 씁니다. -
bg.primary-weak를 사용하는 hover는 선택 상태가 없는 단독 아이콘 버튼에만 허용합니다(color.md상호작용 규칙).
색상과 선택 상태의 구분은 공통 규칙 — 참조 절 variant.selection-distinction을 따릅니다.
로딩 중 포커스
Icon neutral-clear의 Loading+Focused는 투명 배경을 유지하면서 필요한 포커스 외곽선을 남깁니다. 공통 state.focused.presentation 및 state.loading과 함께 적용합니다.
접근성 이름
필수 접근성 이름은 공통 content.label — 참조 절 content.label에 따라 ‘삭제’처럼 행동이 드러나는 말로 짓습니다. 뜻이 모호한 아이콘은 Tooltip과 짝지어 이름을 보입니다. Tooltip 내용은 접근성 이름과 같은 말입니다(Tooltip).
아이콘 버튼 묶음
평면 Icon Button이 3개 이상 병렬로 놓이면 outline 대신 weak로 통일합니다. 라벨 없는 정사각 버튼의 테두리가 반복되면 격자처럼 보여 누를 대상을 구분하기 어렵습니다. 지도·캔버스 위 플로팅 오버레이는 아래 별도 규칙을 따릅니다.
떠 있는 버튼
지도·캔버스처럼 버튼 아래에 독립적인 시각 레이어가 있고, 버튼이 그 위에 오버레이로 떠야 할 때는 일반 평면 Icon Button이 아니라 다음 표면 변형을 씁니다.
| 부위 | 값 |
|---|---|
| 면 | bg.layer-floating |
| 경계 | stroke.neutral 1px |
| 그림자 | shadow.s2 — 아래 지도·캔버스와 버튼의 높이를 구분 |
| 크기·radius·아이콘 | 선택한 size의 치수와 neutral outline 전경 규칙을 따름 |
| Pressed | bg.layer-floating-pressed로 전환. 그림자를 눌림 상태 표시로 키우거나 제거하지 않음 |
-
그림자는 아래 레이어가 실제로 있을 때만 추가합니다. 카드 안 버튼, 일반 툴바, 하단 내비게이션, 입력 옆 아이콘에는 적용하지 않습니다.
-
지도 위에 여러 개를 쌓거나 나란히 놓으면 이 표면을 동일하게 적용하고
dimension.x2(8) 이상 간격을 둡니다.composition.flat-group의 ‘3개 이상 Icon Button은 weak’ 규칙은 평면 컨트롤 무리에 적용하며, 이 플로팅 오버레이에는 적용하지 않습니다. 같은 플로팅 도구 무리 안에 clear·weak를 섞지 않습니다. -
shadow.s2를 시각 목표로 삼아 플랫폼별 그림자 구현을 검증합니다.
크기 선택
공통 size.layout의 크기 선택 원칙을 따르며, 아이콘의 시각 영역과 최소 입력 영역을 분리해 정의합니다.
크기 목록과 기본값은 같은 분류의 contract.json, 시각 값은 styles.json을 참조합니다.
구현 검증
실제 대비·다크·고대비·강제 색상·큰 글자와 입력 영역을 플랫폼에서 검증합니다.
관련 계약
-
Elevation — 플로팅 도구 그림자
-
Iconography — 개념별 아이콘·히트 영역
-
Tooltip — 모호한 아이콘의 이름 표시
시각 매핑
시각 매핑 원본 보기
{ "contractRef": "component.button.icon", "base": { "parts": {} }, "rules": [ { "id": "all-weak-enabled", "when": { "options": { "variant": "weak" } }, "parts": { "container": { "backgroundColor": { "tokenRef": "bg.${options.color}-weak" }, "border": { "value": "none" } } } }, { "id": "primary-weak-enabled", "when": { "options": { "variant": "weak", "color": "primary" }, "states": { "disabled": false } }, "parts": { "icon": { "color": { "tokenRef": "fg.primary-contrast" } } } }, { "id": "neutral-weak-enabled", "when": { "options": { "variant": "weak", "color": "neutral" }, "states": { "disabled": false } }, "parts": { "icon": { "color": { "tokenRef": "fg.neutral-muted" } } } }, { "id": "critical-weak-enabled", "when": { "options": { "variant": "weak", "color": "critical" }, "states": { "disabled": false } }, "parts": { "icon": { "color": { "tokenRef": "fg.critical-contrast" } } } }, { "id": "all-weak-hovered", "when": { "options": { "variant": "weak" }, "states": { "hovered": true } }, "parts": { "container": { "backgroundColor": { "tokenRef": "bg.${options.color}-weak-pressed" } } } }, { "id": "all-weak-pressed", "when": { "options": { "variant": "weak" }, "states": { "pressed": true } }, "parts": { "container": { "backgroundColor": { "tokenRef": "bg.${options.color}-weak-pressed" } } } }, { "id": "all-weak-disabled", "when": { "options": { "variant": "weak" }, "states": { "disabled": true } }, "parts": { "container": { "backgroundColor": { "tokenRef": "bg.neutral-weak" } }, "icon": { "color": { "tokenRef": "fg.disabled" } } } }, { "id": "all-weak-loading", "when": { "options": { "variant": "weak" }, "states": { "loading": true } }, "parts": { "container": { "backgroundColor": { "tokenRef": "bg.${options.color}-weak" } } } }, { "id": "primary-weak-loading", "when": { "options": { "variant": "weak", "color": "primary" }, "states": { "loading": true } }, "parts": { "spinner": { "color": { "tokenRef": "fg.primary-contrast" } } } }, { "id": "neutral-weak-loading", "when": { "options": { "variant": "weak", "color": "neutral" }, "states": { "loading": true } }, "parts": { "spinner": { "color": { "tokenRef": "fg.neutral-muted" } } } }, { "id": "critical-weak-loading", "when": { "options": { "variant": "weak", "color": "critical" }, "states": { "loading": true } }, "parts": { "spinner": { "color": { "tokenRef": "fg.critical-contrast" } } } }, { "id": "all-weak-focused", "when": { "options": { "variant": "weak" }, "states": { "focused": true } }, "parts": { "container": { "outlineColor": { "tokenRef": "stroke.neutral-focused" }, "outlineStyle": { "value": "solid" }, "outlineWidth": { "unit": "px", "value": 2 }, "outlineOffset": { "unit": "px", "value": 0 } } } }, { "id": "all-outline-enabled", "when": { "options": { "variant": "outline" } }, "parts": { "container": { "backgroundColor": { "tokenRef": "bg.layer-floating" }, "borderColor": { "tokenRef": "stroke.neutral" }, "borderStyle": { "value": "solid" }, "borderWidth": { "value": 1, "unit": "px" } } } }, { "id": "primary-outline-enabled", "when": { "options": { "variant": "outline", "color": "primary" }, "states": { "disabled": false } }, "parts": { "icon": { "color": { "tokenRef": "fg.primary-contrast" } } } }, { "id": "neutral-outline-enabled", "when": { "options": { "variant": "outline", "color": "neutral" }, "states": { "disabled": false } }, "parts": { "icon": { "color": { "tokenRef": "fg.neutral-muted" } } } }, { "id": "all-outline-hovered", "when": { "options": { "variant": "outline" }, "states": { "hovered": true } }, "parts": { "container": { "backgroundColor": { "tokenRef": "bg.layer-floating-pressed" } } } }, { "id": "all-outline-pressed", "when": { "options": { "variant": "outline" }, "states": { "pressed": true } }, "parts": { "container": { "backgroundColor": { "tokenRef": "bg.layer-floating-pressed" } } } }, { "id": "all-outline-disabled", "when": { "options": { "variant": "outline" }, "states": { "disabled": true } }, "parts": { "container": { "backgroundColor": { "tokenRef": "bg.layer-floating" } }, "icon": { "color": { "tokenRef": "fg.disabled" } } } }, { "id": "primary-outline-disabled", "when": { "options": { "variant": "outline", "color": "primary" }, "states": { "disabled": true } }, "parts": { "container": { "borderColor": { "tokenRef": "stroke.neutral" } } } }, { "id": "neutral-outline-disabled", "when": { "options": { "variant": "outline", "color": "neutral" }, "states": { "disabled": true } }, "parts": { "container": { "borderColor": { "tokenRef": "stroke.neutral" } } } }, { "id": "all-outline-loading", "when": { "options": { "variant": "outline" }, "states": { "loading": true } }, "parts": { "container": { "backgroundColor": { "tokenRef": "bg.layer-floating" }, "borderColor": { "tokenRef": "stroke.neutral" } } } }, { "id": "primary-outline-loading", "when": { "options": { "variant": "outline", "color": "primary" }, "states": { "loading": true } }, "parts": { "spinner": { "color": { "tokenRef": "fg.primary-contrast" } } } }, { "id": "neutral-outline-loading", "when": { "options": { "variant": "outline", "color": "neutral" }, "states": { "loading": true } }, "parts": { "spinner": { "color": { "tokenRef": "fg.neutral-muted" } } } }, { "id": "all-outline-focused", "when": { "options": { "variant": "outline" }, "states": { "focused": true } }, "parts": { "container": { "outlineColor": { "tokenRef": "stroke.neutral-focused" }, "outlineStyle": { "value": "solid" }, "outlineWidth": { "unit": "px", "value": 2 }, "outlineOffset": { "unit": "px", "value": 0 } } } }, { "id": "neutral-clear-enabled", "when": { "options": { "variant": "clear", "color": "neutral" } }, "parts": { "container": { "backgroundColor": { "value": "transparent" }, "border": { "value": "none" } } } }, { "id": "neutral-clear-enabled-foreground", "when": { "options": { "variant": "clear", "color": "neutral" }, "states": { "disabled": false } }, "parts": { "icon": { "color": { "tokenRef": "fg.neutral-muted" } } } }, { "id": "all-clear-disabled", "when": { "options": { "variant": "clear" }, "states": { "disabled": true } }, "parts": { "icon": { "color": { "tokenRef": "fg.disabled" } } } }, { "id": "neutral-clear-loading", "when": { "options": { "variant": "clear", "color": "neutral" }, "states": { "loading": true } }, "parts": { "container": { "backgroundColor": { "value": "transparent" } }, "spinner": { "color": { "tokenRef": "fg.neutral-muted" } } } }, { "id": "all-clear-focused", "when": { "options": { "variant": "clear" }, "states": { "focused": true } }, "parts": { "container": { "outlineColor": { "tokenRef": "stroke.neutral-focused" }, "outlineStyle": { "value": "solid" }, "outlineWidth": { "unit": "px", "value": 2 }, "outlineOffset": { "value": 0, "unit": "px" } } } }, { "id": "neutral-clear-hovered", "when": { "options": { "variant": "clear", "color": "neutral" }, "states": { "hovered": true } }, "parts": { "container": { "backgroundColor": { "tokenRef": "bg.layer-default-pressed" } } } }, { "id": "neutral-clear-pressed", "when": { "options": { "variant": "clear", "color": "neutral" }, "states": { "pressed": true } }, "parts": { "container": { "backgroundColor": { "tokenRef": "bg.layer-default-pressed" } } } }, { "id": "neutral-clear-focused", "when": { "options": { "variant": "clear", "color": "neutral" }, "states": { "focused": true } }, "parts": { "container": { "backgroundColor": { "tokenRef": "bg.layer-default-pressed" } } } }, { "id": "neutral-clear-disabled", "when": { "options": { "variant": "clear", "color": "neutral" }, "states": { "disabled": true } }, "parts": { "container": { "backgroundColor": { "value": "transparent" } } } }, { "id": "neutral-clear-loading-focused", "when": { "options": { "variant": "clear", "color": "neutral" }, "states": { "loading": true, "focused": true } }, "parts": { "container": { "backgroundColor": { "value": "transparent" } } } }, { "id": "size-web-xs", "when": { "options": { "size": "xs" }, "platform": "web" }, "parts": { "container": { "width": { "tokenRef": "dimension.x6" }, "height": { "tokenRef": "dimension.x6" }, "borderRadius": { "tokenRef": "radius.r1-5" } }, "icon": { "width": { "tokenRef": "dimension.x3-5" }, "height": { "tokenRef": "dimension.x3-5" } } } }, { "id": "size-web-sm", "when": { "options": { "size": "sm" }, "platform": "web" }, "parts": { "container": { "width": { "tokenRef": "dimension.x6" }, "height": { "tokenRef": "dimension.x6" }, "borderRadius": { "tokenRef": "radius.r1-5" } }, "icon": { "width": { "tokenRef": "dimension.x3-5" }, "height": { "tokenRef": "dimension.x3-5" } } } }, { "id": "size-web-md", "when": { "options": { "size": "md" }, "platform": "web" }, "parts": { "container": { "width": { "tokenRef": "dimension.x7" }, "height": { "tokenRef": "dimension.x7" }, "borderRadius": { "tokenRef": "radius.r2" } }, "icon": { "width": { "tokenRef": "dimension.x4" }, "height": { "tokenRef": "dimension.x4" } } } }, { "id": "size-web-lg", "when": { "options": { "size": "lg" }, "platform": "web" }, "parts": { "container": { "width": { "tokenRef": "dimension.x8" }, "height": { "tokenRef": "dimension.x8" }, "borderRadius": { "tokenRef": "radius.r2" } }, "icon": { "width": { "tokenRef": "dimension.x5" }, "height": { "tokenRef": "dimension.x5" } } } }, { "id": "size-app-xs", "when": { "options": { "size": "xs" }, "platform": "app" }, "parts": { "container": { "width": { "tokenRef": "dimension.x6" }, "height": { "tokenRef": "dimension.x6" }, "borderRadius": { "tokenRef": "radius.r1-5" } }, "icon": { "width": { "tokenRef": "dimension.x3-5" }, "height": { "tokenRef": "dimension.x3-5" } }, "hitArea": { "minWidth": { "tokenRef": "dimension.x8" }, "minHeight": { "tokenRef": "dimension.x8" } } } }, { "id": "size-app-sm", "when": { "options": { "size": "sm" }, "platform": "app" }, "parts": { "container": { "width": { "tokenRef": "dimension.x8" }, "height": { "tokenRef": "dimension.x8" }, "borderRadius": { "tokenRef": "radius.r2" } }, "icon": { "width": { "tokenRef": "dimension.x4" }, "height": { "tokenRef": "dimension.x4" } }, "hitArea": { "minWidth": { "tokenRef": "dimension.x11" }, "minHeight": { "tokenRef": "dimension.x11" } } } }, { "id": "size-app-md", "when": { "options": { "size": "md" }, "platform": "app" }, "parts": { "container": { "width": { "tokenRef": "dimension.x10" }, "height": { "tokenRef": "dimension.x10" }, "borderRadius": { "tokenRef": "radius.r2" } }, "icon": { "width": { "tokenRef": "dimension.x5" }, "height": { "tokenRef": "dimension.x5" } }, "hitArea": { "minWidth": { "tokenRef": "dimension.x10" }, "minHeight": { "tokenRef": "dimension.x10" } } } }, { "id": "size-app-lg", "when": { "options": { "size": "lg" }, "platform": "app" }, "parts": { "container": { "width": { "tokenRef": "dimension.x12" }, "height": { "tokenRef": "dimension.x12" }, "borderRadius": { "tokenRef": "radius.r3" } }, "icon": { "width": { "tokenRef": "dimension.x6" }, "height": { "tokenRef": "dimension.x6" } }, "hitArea": { "minWidth": { "tokenRef": "dimension.x12" }, "minHeight": { "tokenRef": "dimension.x12" } } } }, { "id": "critical-outline-enabled", "when": { "options": { "variant": "outline", "color": "critical" }, "states": { "disabled": false } }, "parts": { "icon": { "color": { "tokenRef": "fg.critical-contrast" } } } }, { "id": "critical-outline-loading", "when": { "options": { "variant": "outline", "color": "critical" }, "states": { "loading": true } }, "parts": { "spinner": { "color": { "tokenRef": "fg.critical-contrast" } } } }, { "id": "primary-clear-base", "when": { "options": { "variant": "clear", "color": "primary" } }, "parts": { "container": { "backgroundColor": { "value": "transparent" }, "border": { "value": "none" } } } }, { "id": "primary-clear-foreground", "when": { "options": { "variant": "clear", "color": "primary" }, "states": { "disabled": false } }, "parts": { "icon": { "color": { "tokenRef": "fg.primary-contrast" } }, "spinner": { "color": { "tokenRef": "fg.primary-contrast" } } } }, { "id": "primary-clear-hovered", "when": { "options": { "variant": "clear", "color": "primary" }, "states": { "hovered": true, "disabled": false, "loading": false } }, "parts": { "container": { "backgroundColor": { "tokenRef": "bg.layer-default-pressed" } } } }, { "id": "primary-clear-pressed", "when": { "options": { "variant": "clear", "color": "primary" }, "states": { "pressed": true, "disabled": false, "loading": false } }, "parts": { "container": { "backgroundColor": { "tokenRef": "bg.layer-default-pressed" } } } }, { "id": "critical-clear-base", "when": { "options": { "variant": "clear", "color": "critical" } }, "parts": { "container": { "backgroundColor": { "value": "transparent" }, "border": { "value": "none" } } } }, { "id": "critical-clear-foreground", "when": { "options": { "variant": "clear", "color": "critical" }, "states": { "disabled": false } }, "parts": { "icon": { "color": { "tokenRef": "fg.critical-contrast" } }, "spinner": { "color": { "tokenRef": "fg.critical-contrast" } } } }, { "id": "critical-clear-hovered", "when": { "options": { "variant": "clear", "color": "critical" }, "states": { "hovered": true, "disabled": false, "loading": false } }, "parts": { "container": { "backgroundColor": { "tokenRef": "bg.layer-default-pressed" } } } }, { "id": "critical-clear-pressed", "when": { "options": { "variant": "clear", "color": "critical" }, "states": { "pressed": true, "disabled": false, "loading": false } }, "parts": { "container": { "backgroundColor": { "tokenRef": "bg.layer-default-pressed" } } } }, { "id": "quiet-base", "when": { "options": { "variant": "quiet" } }, "parts": { "container": { "backgroundColor": { "value": "transparent" }, "border": { "value": "none" } }, "icon": { "color": { "tokenRef": "fg.neutral-muted" } } } }, { "id": "quiet-disabled", "when": { "options": { "variant": "quiet" }, "states": { "disabled": true } }, "parts": { "icon": { "color": { "tokenRef": "fg.disabled" } } } }, { "id": "quiet-loading", "when": { "options": { "variant": "quiet" }, "states": { "loading": true } }, "parts": { "spinner": { "color": { "tokenRef": "fg.neutral-muted" } } } }, { "id": "quiet-hovered", "when": { "options": { "variant": "quiet" }, "states": { "hovered": true, "loading": false } }, "parts": { "icon": { "color": { "tokenRef": "fg.neutral" } } } }, { "id": "quiet-pressed", "when": { "options": { "variant": "quiet" }, "states": { "pressed": true, "loading": false } }, "parts": { "icon": { "color": { "tokenRef": "fg.neutral" } } } }, { "id": "quiet-focused", "when": { "options": { "variant": "quiet" }, "states": { "focused": true, "loading": false } }, "parts": { "icon": { "color": { "tokenRef": "fg.neutral" } } } }, { "id": "quiet-focus-ring", "when": { "options": { "variant": "quiet" }, "states": { "focused": true } }, "parts": { "container": { "outlineColor": { "tokenRef": "stroke.neutral-focused" }, "outlineStyle": { "value": "solid" }, "outlineWidth": { "value": 2, "unit": "px" }, "outlineOffset": { "value": 0, "unit": "px" } } } } ]}적합성 확인
검증 조건과 기대 결과 보기
Icon Button 적합성
기준: Icon Button 계약, 공통 계약, 시각 매핑. 공개 옵션의 유효 조합과 web/app 플랫폼의 필수 값을 확인합니다.
실험 패키지는 평면 weak·outline·clear·quiet과 네 크기를 제공합니다. 지도 위 플로팅 표면과 색 대비는 다음 디자인 검토에서 확인합니다.
검증 기록: 대상 구현 / 레이아웃 / 입력 수단 / 브라우저 또는 OS / 테마 / 글자 배율 / 실행일 / 결과·증거. 플랫폼별 미결 사항을 함께 확인합니다.
-
[ ] 구성 스냅샷·접근성 트리: 정사각 컨테이너, 단일 아이콘, 필수 이름, 컨테이너가 만드는 터치 여백을 확인한다.
component.button.icon#anatomy.icon-button -
[ ] solid 금지·neutral weak 기본값·Enabled muted 전경 예외와 미정 조합을 확인한다.
component.button.icon#variant.icon-button -
[ ] 단독 outline·평면 3개 이상 weak·
bg.primary-weakhover의 허용 맥락을 확인한다.component.button.icon#variant.icon-button,component.button.icon#composition.flat-group -
[ ] 상시 보조 행동의
quiet은 중립색 조합만 허용한다. 기본 전경, 호버·누름·포커스의 전경, 투명한 면과 2px 키보드 포커스 외곽선을 확인한다.component.button.common#composition.quiet -
[ ] 지도·캔버스와 평면 툴바를 비교한다. 플로팅 표면·간격8 이상·그림자 유지·clear/weak 비혼합을 상태별 캡처한다.
component.button.icon#variant.floating-overlay -
[ ] 접근성 이름과 Tooltip이 같은 행동 문구인지 대조한다.
component.button.icon#content.accessible-name,component.button.common#content.label -
[ ] Enabled·Disabled·Loading 중 단일 표현 상태와 원시 Hovered·Pressed·Focused 입력, 공통 해석 후 적용 상태를 함께 기록한다. 허용된 조합을 캡처해 base와 모든 일치 규칙의 속성별 합성 결과와 비교한다. Enabled·Disabled·Loading은 같은 축에서 하나만 선택하고, 둘 이상을 함께 적용하는 경우를 허용하지 않는지 확인한다. options·platform·states의 고정 우선순위나 배열 순서를 사용하지 않고 false 조건도 비교하며 미해소 충돌을 오류로 검출한다.
component.button.common#state.interpretation,component.button.common#state.mapping,component.button.common#state.focused.presentation -
[ ] Disabled에서 입력별 활성화와 시각 변화 이벤트를 기록한다. Tab 순차 탐색 제외·활성화 차단·명시된 비활성 색을 확인한다.
component.button.common#state.disabled.activation -
[ ] Selected 기능을 Toggle Button·Segmented Control·Chip으로 분리했는지 확인한다.
component.button.common#state.selected.absence -
[ ] 로딩 전후 폭·Enabled 색·접근성 트리·중복 동작 이벤트를 비교한다. 포인터가 위에 있거나 press 입력이 남아 있어도 Hovered·Pressed 표현을 적용하지 않는지, 포인터·키보드·보조기술 경로의 중복 활성화를 차단하는지 확인한다. 스피너·기존 포커스와 필요한 외곽선 유지·Tab 이탈·web aria-busy도 확인한다.
component.button.common#state.interpretation,component.button.common#state.loading -
[ ] 실제 렌더의 대비, 다크·고대비·강제 색상, 글자 배율·긴 번역·RTL·overflow를 확인한다. 미정 매핑은 통과로 간주하지 않는다. 미결 사항
-
[ ] 표현 상태가 Enabled인 동안 Focused와 Hovered·Pressed가 공존하면 외곽선은 유지되고 배경은 조작 상태를 따르는지 확인한다. Loading 진입 후 원시 hover/press와 관계없이 기존 포커스·필요한 외곽선과 Tab 이탈을 확인한다.
component.button.common#state.interpretation,component.button.common#state.focused.presentation,component.button.common#state.loadingIcon neutral-clear의 Loading+Focused 배경은 transparent이며 clear offset 미정은 별도로 기록한다. -
[ ] xs·sm·md·lg와 기본 md를 검증한다. web에는 모바일 브라우저를 포함한다. 공개 size에 필수 값이 없으면 커버리지 오류로 검출하고 md로 자동 대체하지 않는다.
component.button.icon#size.selection -
[ ] 요청 진행 중 폼 조건·권한이 바뀌거나 작업이 완료·실패하는 실제 흐름에서 외부 조건을 바탕으로 배타적인 표현 상태 하나를 선택하는 전이와 정보 전달을 검토한다. 별도 외부 정보가 필요해도 Enabled·Disabled·Loading을 동시에 적용하지 않는다. Disabled 포커스 전이와 누른 도중 표현 상태가 바뀔 때의 취소·해제는 정책을 확정한 뒤 검증한다. 공통 해석을 실제 UI·미리보기·검증에 일관되게 적용하고 미결 항목은 통과로 세지 않는다. 검토 사항
저장소 원본 core/components/button/icon-button/contract.md