DashboardSearchButton

DashboardSearch 모달을 여는 사전 스타일 단추입니다.A pre-styled Button to open the DashboardSearch modal.

Usage

DashboardSearchButton 구성 요소는 DashboardSearch 모달을 열 수 있습니다.

<template>
  <UDashboardSearchButton />
</template>

Button 구성 요소를 확장하므로 color, variant, size 등과 같은 모든 속성을 전달할 수 있습니다.

<template>
  <UDashboardSearchButton variant="subtle" />
</template>
기본적으로 버튼은 축소되지 않은 경우 color="neutral" 및 variant="outline", 축소된 경우 variant="ghost"로 지정됩니다.

Collapsed 파일

collapsed 소품을 사용하여 버튼의 레이블과 kbds를 숨깁니다. 기본값은 false입니다.

<template>
  <UDashboardSearchButton collapsed />
</template>
DashboardSidebar 구성 요소의 버튼을 사용하는 경우 collapsed 슬롯 소품을 직접 사용합니다.

Kbds 파일

kbds 소품을 사용하여 단추에 키보드 키를 표시합니다. DashboardSearch 구성 요소의 기본 바로 가기와 일치하려면 기본값이 ['meta', 'K']입니다.

<template>
  <UDashboardSearchButton :kbds="['alt', 'O']" />
</template>

API 사용

Props (### Props)

Prop Default Type
as
'button'
any

The element or component this component should render as when not a link.

icon
appConfig.ui.icons.search
any

The icon displayed in the button. Set to false to hide the icon.

label
t('dashboardSearchButton.label')
string

The label displayed in the button.

color
'neutral'
"error" | "neutral" | "primary" | "secondary" | "success" | "info" | "warning"

The color of the button.

variant
"solid" | "outline" | "soft" | "subtle" | "ghost" | "link"

The variant of the button. Defaults to 'outline' when not collapsed, 'ghost' when collapsed.

collapsed
false
boolean

Whether the button is collapsed.

tooltip
false
boolean | TooltipProps

Display a tooltip on the button when is collapsed with the button label. This has priority over the global tooltip prop.

kbds
["meta", "k"]
(string | undefined)[] | KbdProps[]

The keyboard keys to display in the button. { variant: 'subtle' }

autofocus
false | true | "true" | "false"
disabled
boolean
name
string
type
'button'
"reset" | "submit" | "button"

The type of the button when not a link.

activeColor
"error" | "neutral" | "primary" | "secondary" | "success" | "info" | "warning"
activeVariant
"solid" | "outline" | "soft" | "subtle" | "ghost" | "link"
size
'md'
"xs" | "sm" | "md" | "lg" | "xl"
square
boolean

Render the button with equal padding on all sides.

block
boolean

Render the button full width.

loadingAuto
boolean

Set loading state automatically based on the @click promise state

avatar
AvatarProps

Display an avatar on the left side.

leading
boolean

When true, the icon will be displayed on the left side.

leadingIcon
any

Display an icon on the left side.

trailing
boolean

When true, the icon will be displayed on the right side.

trailingIcon
any

Display an icon on the right side.

loading
boolean

When true, the loading icon will be displayed.

loadingIcon
appConfig.ui.icons.loading
any

The icon when the loading prop is true.

ui
{ base?: SlotClass; label?: SlotClass; trailing?: SlotClass; } & { base?: SlotClass; label?: SlotClass; leadingIcon?: SlotClass; leadingAvatar?: SlotClass; leadingAvatarSize?: SlotClass; trailingIcon?: SlotClass; }
이 구성 요소는 모든 기본 <button> HTML 속성도 지원합니다.

Slots

Slot Type
leading
{ ui: object; }
default
{ ui: object; }
trailing
{ ui: object; }

Theme 테마

app.config.ts
export default defineAppConfig({
  ui: {
    dashboardSearchButton: {
      slots: {
        base: '',
        label: '',
        trailing: 'hidden lg:flex items-center gap-0.5 ms-auto'
      },
      variants: {
        collapsed: {
          true: {
            label: 'hidden',
            trailing: 'lg:hidden'
          }
        }
      }
    }
  }
})
vite.config.ts
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import ui from '@nuxt/ui/vite'

export default defineConfig({
  plugins: [
    vue(),
    ui({
      ui: {
        dashboardSearchButton: {
          slots: {
            base: '',
            label: '',
            trailing: 'hidden lg:flex items-center gap-0.5 ms-auto'
          },
          variants: {
            collapsed: {
              true: {
                label: 'hidden',
                trailing: 'lg:hidden'
              }
            }
          }
        }
      }
    })
  ]
})

변경 로그

No recent changes