문서 메뉴

UIMenubar

여러 명령 메뉴를 한 줄에 배치합니다.

기본 사용법

메뉴 모음에 명령 배치

최상위 메뉴와 그 하위 명령을 parentID로 연결합니다. 파일과 편집 메뉴를 열어 명령을 실행합니다.

실행한 명령 없음
<script setup lang="ts">
import { UIMenubar } from "@connextable/ui";
import { ref } from "vue";

const commands = [
  { id: "file", parentID: null, label: "파일" },
  { id: "new-project", parentID: "file", label: "새 프로젝트" },
  {
    id: "open-project",
    parentID: "file",
    label: "프로젝트 열기",
    separatorBefore: true,
  },
  { id: "edit", parentID: null, label: "편집" },
  { id: "undo", parentID: "edit", label: "실행 취소" },
  { id: "redo", parentID: "edit", label: "다시 실행" },
  { id: "help", parentID: null, label: "도움말" },
  { id: "shortcuts", parentID: "help", label: "키보드 단축키" },
];
const lastAction = ref("");
</script>

<template>
  <UIMenubar :items="commands" label="앱 명령" @invoke="lastAction = $event" />
</template>

설정과 동작

파일 메뉴를 열어 하위 명령에 지정한 아이콘을 확인합니다.

Redo를 비활성화하면 편집 메뉴에서 선택되지 않습니다.

편집 메뉴를 열고 U를 눌러 실행 취소로 이동합니다.

구성 컴포넌트

구조와 배치

UIMenubarItem

루트에 등록된 값 하나를 표시하고 상호작용을 연결합니다.

비활성 편집 명령 예제
UIMenubarSeparator

항목 또는 조작 영역을 시각적으로 구분합니다.

비활성 편집 명령 예제
UIMenubarContent

트리거 또는 현재 값에 연결된 콘텐츠를 담습니다.

비활성 편집 명령 예제

주요 API

속성과 모델

items[].icon타입Component

이름 앞에 표시할 Vue 아이콘 컴포넌트입니다.

하위 명령에 아이콘 표시 예제
items타입readonly Command[]

id와 parentID로 최상위 메뉴와 하위 명령을 구성합니다. icon으로 명령 이름 앞에 아이콘을 표시합니다.

하위 명령에 아이콘 표시 예제
text-value타입((id: string) => string) | undefined

각 id의 이름을 키보드 탐색에 사용할 텍스트로 변환합니다.

비활성 편집 명령 예제
Content for

이 콘텐츠가 속한 상위 메뉴 id입니다.

전체 속성, 이벤트와 슬롯

UIMenubar

as
PrimitiveAs | undefined
as-child
boolean | undefined
disabled
boolean | undefined
label
string | undefined
@update:open
(_value: boolean) => any
text-value
((id: string) => string) | undefined
policies
MenuPolicies<string> | undefined
default-highlighted-value
string | null | undefined
disabled-items
readonly string[] | undefined
@invoke
(_value: string) => any
items필수
readonly Command[]
trigger-label
string | undefined
#default
(props: MenuRootSlotProps) => VNodeChild
#trigger
(state: MenuRootSlotProps) => VNodeChild

UIMenubarItem

replace
boolean | undefined
disabled
boolean | undefined
external
boolean | undefined
as-child
boolean | undefined
prefetch
boolean | undefined
no-prefetch
boolean | undefined
value필수
string
as
string | Component | undefined
href
string | undefined
icon
Component | undefined
to
string | RouteLocationAsRelativeGeneric | RouteLocationAsPathGeneric | undefined
prefetch-on
PrefetchTrigger | Partial<Record<PrefetchTrigger, boolean>> | undefined
#default
(state: MenuItemSlotProps) => VNodeChild

UIMenubarSeparator

as
PrimitiveAs | undefined
as-child
boolean | undefined

UIMenubarContent

as
PrimitiveAs | undefined
as-child
boolean | undefined
for필수
string
#default
(props: MenuRootSlotProps) => VNodeChild