ActionSheet 액션 시트
모바일 하단 액션 메뉴: 목록형 items(인접한 같은 group끼리 그룹화, 비활성화 항목은 회색, color: 'danger'는 파괴적 작업), 상단 제목, 취소 버튼. 표시는 제어형 modelValue(dialog와 동일한 계약)이며 마스크와 오버레이 스택은 이 리포지터리의 overlay 체계를 재사용합니다 (여러 레이어가 겹칠 때 Esc는 최상위만 닫고, 스크롤을 잠그고, 포커스 트랩을 적용합니다).
그룹화 / 비활성화 / 마스크 닫기 판정과 클래스 이름은 모두 @lh-ui/share/core/action-sheet의 순수 함수에서 옵니다. cancelText를 지정하지 않으면 취소 버튼 라벨은 locales에서 가져옵니다.
기본 사용법
items에 액션 항목을 지정합니다(name 필수, subname은 보조 설명). 활성화된 항목을 클릭하면 select(항목 참조 + 전역 인덱스)를 emit하고 닫습니다:
기본 사용법
vue
<script setup lang="ts">
import { ref } from 'vue'
import { LhButton, LhActionSheet } from '@lh-ui/vue3'
const visible = ref(false)
const items = [
{ name: '사진 촬영', subname: '카메로부터' },
{ name: '앨범에서 선택' },
]
</script>
<template>
<!-- 기본 사용법 -->
<LhButton @click="visible = true">액션 시트 열기</LhButton>
<LhActionSheet v-model="visible" title="작업 선택" :items="items" />
</template>vue
<script>
import { LhButton, LhActionSheet } from '@lh-ui/vue3'
export default {
components: { LhButton, LhActionSheet },
data() {
return {
visible: false,
items: [
{ name: '사진 촬영', subname: '카메로부터' },
{ name: '앨범에서 선택' },
],
}
},
}
</script>
<template>
<!-- 기본 사용법 -->
<LhButton @click="visible = true">액션 시트 열기</LhButton>
<LhActionSheet v-model="visible" title="작업 선택" :items="items" />
</template>그룹화 / 비활성화 / 위험색
인접한 같은 group의 항목이 한 그룹이 됩니다(그룹 사이에 회색 구분대); disabled는 회색 처리하고 클릭에 반응하지 않습니다; color: 'danger'는 위험색 토큰을, 다른 색 값은 인라인 스타일로 적용합니다:
그룹화와 위험 작업
vue
<script setup lang="ts">
import { ref } from 'vue'
import { LhButton, LhActionSheet } from '@lh-ui/vue3'
import type { LhActionSheetItem } from '@lh-ui/vue3'
const visible = ref(false)
const items: LhActionSheetItem[] = [
{ name: '배경화면으로 설정' },
{ name: '마커 편집', group: 'edit' },
{ name: '회전 및 자르기', group: 'edit' },
{ name: '삭제', color: 'danger' },
]
function onSelect(item: LhActionSheetItem, index: number) {
console.log(item.name, index)
}
</script>
<template>
<!-- 그룹화와 위험 작업 -->
<LhButton @click="visible = true">사진 삭제</LhButton>
<LhActionSheet v-model="visible" :items="items" cancel-text="취소" @select="onSelect" />
</template>vue
<script>
import { LhButton, LhActionSheet } from '@lh-ui/vue3'
export default {
components: { LhButton, LhActionSheet },
data() {
return {
visible: false,
items: [
{ name: '배경화면으로 설정' },
{ name: '마커 편집', group: 'edit' },
{ name: '회전 및 자르기', group: 'edit' },
{ name: '삭제', color: 'danger' },
],
}
},
methods: {
onSelect(item, index) {
console.log(item.name, index)
},
},
}
</script>
<template>
<!-- 그룹화와 위험 작업 -->
<LhButton @click="visible = true">사진 삭제</LhButton>
<LhActionSheet v-model="visible" :items="items" cancel-text="취소" @select="onSelect" />
</template>닫기 동작
마스크 클릭(closeOnClickMask, 기본값 true)과 Esc(최상위 레이어일 때)가 시트를 닫고 update:modelValue를 emit합니다. 취소 버튼은 cancel을 emit합니다(cancelText에 빈 문자열로 숨김):
vue
<!-- 마스크 클릭으로 닫지 않음(항목 / 취소 / Esc만 유효) -->
<LhActionSheet v-model="visible" :items="items" :close-on-click-mask="false" />
<!-- 취소 버튼 숨김 -->
<LhActionSheet v-model="visible" :items="items" cancel-text="" />API
ActionSheet Props
| 속성 | 설명 | 타입 | 기본값 |
|---|---|---|---|
| modelValue | 표시(제어형) | boolean | false |
| items | 액션 항목 목록 | LhActionSheetItem[] | () => [] |
| title | 상단 제목 | string | — |
| cancelText | 취소 버튼 라벨(빈 문자열로 숨김, 미지정 시 locales의 "취소") | string | — |
| closeOnClickMask | 마스크 클릭으로 닫기 | boolean | true |
| safeAreaInsetBottom | 하단 안전 영역 여백 | boolean | true |
| sx | sx 빠른 레이아웃 속성(패널 본체에 적용) | LhSxProps | — |
ActionSheet Items
| 속성 | 설명 | 타입 | 기본값 |
|---|---|---|---|
| name | 액션 이름 | string | — |
| subname | 보조 설명(회색 둘째 줄) | string | — |
| disabled | 항목 비활성화(회색, 클릭 불가) | boolean | false |
| color | 글자색('danger'는 위험색 토큰, 다른 값은 인라인) | string | — |
| group | 그룹 키(같은 키끼리 인접 그룹화, 미지정은 기본 그룹) | string | — |
ActionSheet Events
| 이벤트명 | 설명 | 콜백 |
|---|---|---|
| update:modelValue | 표시 상태 변화 | (value: boolean) |
| select | 활성화된 항목 클릭 시 발생(이후 시트가 닫힘) | (item: LhActionSheetItem, index: number) |
| cancel | 취소 버튼 클릭 시 발생(이후 시트가 닫힘) | — |
접근성
- 패널 루트는
role="dialog"+aria-modal="true"이고aria-label은title또는 고정 라벨입니다 - 열리면 포커스가 패널 안으로 트랩되고 닫히면 원래 포커스로 돌아갑니다(dialog / drawer와 동일 구현)
- 각 항목은 실제
<button>이고 비활성화 항목은disabled속성을 가집니다

