--- Title: Affix URL: https://element-plus.org/en-US/component/affix --- # Affix Fix the element to a specific visible area. ## Basic Usage Affix is fixed at the top of the page by default. ## Target Container You can set `target` attribute to keep the affix in the container at all times. It will be hidden if out of range. ## Fixed Position The affix component provides two fixed positions: `top` and `bottom`. ## API ### Attributes | Name | Description | Type | Default | | -------------------- | ---------------------------------------------------------------------------------------------- | ------------------------------- | ------- | | offset | offset distance | ^[number] | 0 | | position | position of affix | ^[enum]`'top' \| 'bottom'` | top | | target | target container (CSS selector) | ^[string] | — | | z-index | `z-index` of affix | ^[number] | 100 | | teleported ^(2.13.0) | whether affix element is teleported, if `true` it will be teleported to where `append-to` sets | ^[boolean] | false | | append-to ^(2.13.0) | which element the affix element appends to | ^[CSSSelector] / ^[HTMLElement] | body | ### Events | Name | Description | Type | | ------ | --------------------------------- | ------------------------------------------------------------------- | | change | triggers when fixed state changed | ^[Function]`(fixed: boolean) => void` | | scroll | triggers when scrolling | ^[Function]`(value: { scrollTop: number, fixed: boolean }) => void` | ### Slots | Name | Description | | ------- | ------------------------- | | default | customize default content | ### Exposes | Name | Description | Type | | ---------- | --------------------------- | ----------------------- | | update | update affix state manually | ^[Function]`() => void` | | updateRoot | update rootRect info | ^[Function]`() => void` | ## Vue Examples ### basic.vue ```vue ``` ### fixed.vue ```vue ``` ### target.vue ```vue ``` --- Title: Alert URL: https://element-plus.org/en-US/component/alert --- # Alert Displays important alert messages. ## Basic Usage Alert components are non-overlay elements in the page that does not disappear automatically. ## Theme Alert provide two different themes, `light` and `dark`. ## Customizable Close Button Customize the close button as texts or other symbols. ## With Icon Displaying an icon improves readability. ## Centered Text Use the `center` attribute to center the text. ## With Description Description includes a message with more detailed information. ## With Icon and Description ## Alert API ### Attributes | Name | Description | Type | Default | | ----------- | ---------------------------------------- | -------------------------------------------------------------------------- | ------- | | title | alert title. | ^[string] | — | | type | alert type. | ^[enum]`'primary' (2.9.11) \| 'success' \| 'warning' \| 'info' \| 'error'` | info | | description | descriptive text. | ^[string] | — | | closable | whether alert can be dismissed. | ^[boolean] | true | | center | whether content is placed in the center. | ^[boolean] | false | | close-text | customized close button text. | ^[string] | — | | show-icon | whether a type icon is displayed. | ^[boolean] | false | | effect | theme style. | ^[enum]`'light' \| 'dark'` | light | ### Events | Name | Description | Type | | ----- | ----------------------------- | ---------------------------------------- | | close | trigger when alert is closed. | ^[Function]`(event: MouseEvent) => void` | ### Slots | Name | Description | | ------------- | --------------------------------- | | default | content of the alert description. | | title | content of the alert title. | | icon ^(2.9.7) | content of the alert icon. | ## Vue Examples ### basic.vue ```vue ``` ### center.vue ```vue ``` ### close-button.vue ```vue ``` ### description.vue ```vue ``` ### icon-description.vue ```vue ``` ### icon.vue ```vue ``` ### theme.vue ```vue ``` --- Title: Anchor URL: https://element-plus.org/en-US/component/anchor --- # Anchor Through the anchor point, you can quickly find the position of the information content on the current page. ## Basic Usage The most basic usage ## Horizontal Mode Horizontally aligned anchors ## Scroll Container Custom scroll area, use `offset` props can set anchor scroll offset, listen the `link-click` event and prevents browser default behavior then it will not change history. ## Anchor link change Listening for anchor link change ## Underline type set `type="underline"` change to underline type ## Affix Mode Use the affix component to fix the anchor point within the page. ## Anchor API ### Anchor Attributes | Property | Description | Type | Default | | -------------------------- | ---------------------------------------------------------- | ------------------------------------- | ---------- | | container | Scroll container. | `string` \| `HTMLElement` \| `Window` | — | | offset | Set the offset of the anchor scroll. | `number` | 0 | | bound | The offset of the element starting to trigger the anchor. | `number` | 15 | | duration | Set the scroll duration of the container, in milliseconds. | `number` | 300 | | marker | Whether to show the marker. | ^[boolean] | true | | type | Set Anchor type. | ^[enum]`'default' \| 'underline'` | `default` | | direction | Set Anchor direction. | ^[enum]`'vertical' \| 'horizontal'` | `vertical` | | select-scroll-top ^(2.9.2) | Scroll whether link is selected at the top | ^[boolean] | false | ### Anchor Events | Name | Description | Type | | ------ | ------------------------------------------ | --------------------------------------------------- | | change | Callback when the step changes | ^[Function]`(href: string) => void` | | click | Triggered when the user clicks on the link | ^[Function]`(e: MouseEvent, href?: string) => void` | ### Anchor Exposes | Name | Description | Type | | -------- | ----------------------------------------- | ----------------------------------- | | scrollTo | Manually scroll to the specific position. | ^[Function]`(href: string) => void` | ### Anchor Slots | Name | Description | | ------- | ------------------------- | | default | AnchorLink component list | ### AnchorLink Attributes | Property | Description | Type | Default | | -------- | ------------------------------------ | -------- | ------- | | title | The text content of the anchor link. | `string` | — | | href | The address of the anchor link. | `string` | — | ### AnchorLink Slots | Name | Description | | -------- | ------------------------------- | | default | The content of the anchor link. | | sub-link | Slots for child links. | ## Vue Examples ### affix.vue ```vue ``` ### basic.vue ```vue ``` ### change.vue ```vue ``` ### horizontal.vue ```vue ``` ### scroll.vue ```vue ``` ### underline.vue ```vue ``` --- Title: Autocomplete URL: https://element-plus.org/en-US/component/autocomplete --- # Autocomplete Get some recommended tips based on the current input. ## Basic Usage Autocomplete component provides input suggestions. ## Custom template Customize how suggestions are displayed. ## Remote search Search data from server-side. ## Custom Loading ^(2.5.0) Override loading content. ## Custom Header & Footer ^(2.10.6) You can customize both the header and footer of the dropdown using slots ## API ### Attributes | Name | Description | Type | Default | | ------------------------------------ | -------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ------------ | | model-value / v-model | binding value | ^[string] | — | | placeholder | the placeholder of Autocomplete | ^[string] | — | | clearable | whether to show clear button | ^[boolean] | false | | disabled | whether Autocomplete is disabled | ^[boolean] | false | | value-key | key name of the input suggestion object for display | ^[string] | value | | debounce | debounce delay when typing, in milliseconds | ^[number] | 300 | | placement | placement of the popup menu | ^[enum]`'top' \| 'top-start' \| 'top-end' \| 'bottom' \| 'bottom-start' \| 'bottom-end'` | bottom-start | | fetch-suggestions | a method to fetch input suggestions. When suggestions are ready, invoke `callback(data:[])` to return them to Autocomplete | ^[Array] / ^[Function]`(queryString: string, callback: callbackfn) => void` | — | | trigger-on-focus | whether show suggestions when input focus | ^[boolean] | true | | select-when-unmatched | whether to emit a `select` event on enter when there is no autocomplete match | ^[boolean] | false | | name | same as `name` in native input | ^[string] | — | | aria-label ^(a11y) ^(2.7.2) | native `aria-label` attribute | ^[string] | — | | hide-loading | whether to hide the loading icon in remote search | ^[boolean] | false | | popper-class | custom class name for autocomplete's dropdown | ^[string] / ^[object] | '' | | popper-style ^(2.11.4) | custom style for autocomplete's dropdown | ^[string] / ^[object] | — | | teleported | whether select dropdown is teleported to the body | ^[boolean] | true | | append-to ^(2.9.9) | which select dropdown appends to | ^[CSSSelector] / ^[HTMLElement] | — | | highlight-first-item | whether to highlight first item in remote search suggestions by default | ^[boolean] | false | | fit-input-width | whether the width of the dropdown is the same as the input | ^[boolean] | false | | popper-append-to-body ^(deprecated) | whether to append the dropdown to body. If the positioning of the dropdown is wrong, you can try to set this prop to false | ^[boolean] | false | | loop-navigation ^(2.11.4) | whether keyboard navigation loops from end to start | ^[boolean] | true | | [input props](./input.md#attributes) | — | — | — | ### Events | Name | Description | Type | | ------ | --------------------------------------------------------------- | ------------------------------------------------ | | blur | triggers when Input blurs | ^[Function]`(event: FocusEvent) => void` | | focus | triggers when Input focuses | ^[Function]`(event: FocusEvent) => void` | | input | triggers when the Input value change | ^[Function]`(value: string \| number) => void` | | clear | triggers when the Input is cleared by clicking the clear button | ^[Function]`() => void` | | select | triggers when a suggestion is clicked | ^[Function]`(item: Record) => void` | | change | triggers when the icon inside Input value change | ^[Function]`(value: string \| number) => void` | ### Slots | Name | Description | Type | | ---------------- | ------------------------------------- | ---------------------------------------- | | default | custom content for input suggestions | ^[object]`{ item: Record }` | | header ^(2.10.6) | content at the top of the dropdown | - | | footer ^(2.10.6) | content at the bottom of the dropdown | - | | prefix | content as Input prefix | - | | suffix | content as Input suffix | - | | prepend | content to prepend before Input | - | | append | content to append after Input | - | | loading ^(2.5.0) | override loading content | - | ### Exposes | Name | Description | Type | | ---------------- | ------------------------------------------- | --------------------------------------------------- | | activated | if autocomplete activated | ^[object]`Ref` | | blur | blur the input element | ^[Function]`() => void` | | close | collapse suggestion list | ^[Function]`() => void` | | focus | focus the input element | ^[Function]`() => void` | | handleSelect | triggers when a suggestion is clicked | ^[Function]`(item: any) => promise` | | handleKeyEnter | handle keyboard enter event | ^[Function]`() => promise` | | highlightedIndex | the index of the currently highlighted item | ^[object]`Ref` | | highlight | highlight an item in a suggestion | ^[Function]`(itemIndex: number) => void` | | inputRef | el-input component instance | ^[object]`Ref` | | loading | remote search loading indicator | ^[object]`Ref` | | popperRef | el-tooltip component instance | ^[object]`Ref` | | suggestions | fetch suggestions result | ^[object]`Ref[]>` | | getData ^(2.8.4) | loading suggestion list | ^[Function]`(queryString: string) => promise` | ## Vue Examples ### autocomplete-template.vue ```vue ``` ### autocomplete.vue ```vue ``` ### custom-header-footer.vue ```vue ``` ### custom-loading.vue ```vue ``` ### remote-search.vue ```vue ``` --- Title: Avatar URL: https://element-plus.org/en-US/component/avatar --- # Avatar Avatars can be used to represent people or objects. It supports images, Icons, or characters. ## Basic Usage Use `shape` and `size` prop to set avatar's shape and size. ## Types It supports images, Icons, or characters. ## Fallback fallback when image load error. ## Fit Container Set how the image fit its container for an image avatar, same as [object-fit](https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit). ## Avatar Group ^(2.13.1) Displayed as a avatar group. ## Avatar API ### Avatar Attributes | Name | Description | Type | Default | | ------- | --------------------------------------------------------- | ----------------------------------------------------------------- | ------- | | icon | representation type to icon, more info on icon component. | ^[string] / ^[Component] | — | | size | avatar size. | ^[number] / ^[enum]`'large' \| 'default' \| 'small'` | — | | shape | avatar shape. | ^[enum]`'circle' \| 'square'` | — | | src | the source of the image for an image avatar. | `string` | — | | src-set | native attribute `srcset` of image avatar. | `string` | — | | alt | native attribute `alt` of image avatar. | `string` | — | | fit | set how the image fit its container for an image avatar. | ^[enum]`'fill' \| 'contain' \| 'cover' \| 'none' \| 'scale-down'` | cover | ### Avatar Events | Name | Description | Type | | ----- | ------------------------------ | ------------------------------- | | error | trigger when image load error. | ^[Function]`(e: Event) => void` | ### Avatar Slots | Name | Description | | ------- | ------------------------- | | default | customize avatar content. | ## AvatarGroup API ^(2.13.1) ### AvatarGroup Attributes | Name | Description | Type | Default | | ------------------------ | ----------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | | size | control the size of avatars in this avatar-group | ^[number] / ^[enum]`'large' \| 'default' \| 'small'` | — | | shape | control the shape of avatars in this avatar-group | ^[enum]`'circle' \| 'square'` | — | | collapse-avatars | whether to collapse avatars | ^[boolean] | false | | collapse-avatars-tooltip | whether show all collapsed avatars when mouse hover text of the collapse-avatar. To use this, `collapse-avatars` must be true | ^[boolean] | false | | max-collapse-avatars | the max avatars number to be shown. To use this, `collapse-avatars` must be true | ^[number] | 1 | | effect | tooltip theme, built-in theme: `dark` / `light` | ^[enum]`'dark' \| 'light'` / ^[string] | light | | placement | placement of tooltip | ^[enum]`'top' \| 'top-start' \| 'top-end' \| 'bottom' \| 'bottom-start' \| 'bottom-end' \| 'left' \| 'left-start' \| 'left-end' \| 'right' \| 'right-start' \| 'right-end'` | top | | popper-class | custom class name for tooltip | ^[string] | '' | | popper-style | custom style for tooltip | ^[string] / ^[object] | — | | collapse-class | custom class name for the collapse-avatar | ^[string] | '' | | collapse-style | custom style for the collapse-avatar | ^[string] / ^[object] | — | ## Vue Examples ### basic.vue ```vue ``` ### fallback.vue ```vue ``` ### fit.vue ```vue ``` ### group.vue ```vue ``` ### types.vue ```vue ``` --- Title: Backtop URL: https://element-plus.org/en-US/component/backtop --- # Backtop A button to back to top. ## Basic Usage Scroll down to see the bottom-right button. ## Customizations Display area is 40px \* 40px. ## API ### Attributes | Name | Description | Type | Default | | ----------------- | -------------------------------------------------------------------- | --------- | ------- | | target | the target to trigger scroll. | ^[string] | — | | visibility-height | the button will not show until the scroll height reaches this value. | ^[number] | 200 | | right | right distance. | ^[number] | 40 | | bottom | bottom distance. | ^[number] | 40 | ### Events | Name | Description | Parameters | | ----- | -------------------- | -------------------------------------- | | click | triggers when click. | ^[Function]`(evt: MouseEvent) => void` | ### Slots | Name | Description | | ------- | -------------------------- | | default | customize default content. | ## Vue Examples ### basic.vue ```vue ``` ### custom.vue ```vue ``` --- Title: Badge URL: https://element-plus.org/en-US/component/badge --- # Badge A number or status mark on buttons and icons. ## Basic Usage Displays the amount of new messages. ## Max Value You can customize the max value. ## Customizations Displays text content other than numbers. Or you can use the `content` slot to customize content. ## Red Dot Use a red dot to mark content that needs to be noticed. ## Offset ^(2.7.0) ## API ### Attributes | Name | Description | Type | Default | | -------------------- | ----------------------------------------------------------------------------- | ------------------------------------------------------------------ | ------- | | value | display value. | ^[string] / ^[number] | '' | | max | maximum value, shows `{max}+` when exceeded. Only works if value is a number. | ^[number] | 99 | | is-dot | if a little dot is displayed. | ^[boolean] | false | | hidden | hidden badge. | ^[boolean] | false | | type | badge type. | ^[enum]`'primary' \| 'success' \| 'warning' \| 'danger' \| 'info'` | danger | | show-zero ^(2.6.0) | Whether to show badge when value is zero. | ^[boolean] | true | | color ^(2.6.3) | background color of the dot | ^[string] | | | offset ^(2.7.0) | offset of badge | ^[array]`[number, number]` | [0, 0] | | badge-style ^(2.7.1) | custom style of badge | ^[object]`CSSProperties` | — | | badge-class ^(2.7.1) | custom class of badge | ^[string] | — | ### Slots | Name | Description | Type | | ---------------- | ------------------------- | ---------------------------- | | default | customize default content | - | | content ^(2.9.1) | customize badge content | ^[object]`{ value: string }` | ## Vue Examples ### basic.vue ```vue ``` ### customize.vue ```vue ``` ### dot.vue ```vue ``` ### max.vue ```vue ``` ### offset.vue ```vue ``` --- Title: Border URL: https://element-plus.org/en-US/component/border --- # Border We standardize the borders that can be used in buttons, cards, pop-ups and other components. ## Border style There are few border styles to choose. ## Radius There are few radius styles to choose. ## Shadow There are few shadow styles to choose. ## Vue Examples ### border.vue ```vue ``` ### radius.vue ```vue ``` ### shadow.vue ```vue ``` --- Title: Breadcrumb URL: https://element-plus.org/en-US/component/breadcrumb --- # Breadcrumb Displays the location of the current page, making it easier to browser back. ## Basic usage ## Icon separator ## Breadcrumb API ### Breadcrumb Attributes | Name | Description | Type | Default | | -------------- | -------------------------------- | ------------------------ | ------- | | separator | separator character | ^[string] | / | | separator-icon | icon component of icon separator | ^[string] / ^[Component] | — | ### Breadcrumb Slots | Name | Description | Subtags | | ------- | ------------------------- | --------------- | | default | customize default content | Breadcrumb Item | ## BreadcrumbItem API ### BreadcrumbItem Attributes | Name | Description | Type | Default | | ------- | --------------------------------------------------------- | --------------------------------------- | ------- | | to | target route of the link, same as `to` of `vue-router` | ^[string] / ^[object]`RouteLocationRaw` | '' | | replace | if `true`, the navigation will not leave a history record | ^[boolean] | false | ### BreadcrumbItem Slots | Name | Description | | ------- | ------------------------- | | default | customize default content | ## Vue Examples ### basic.vue ```vue ``` ### icon.vue ```vue ``` --- Title: Button URL: https://element-plus.org/en-US/component/button --- # Button Commonly used button. ## Basic usage ## Disabled Button The `disabled` attribute determines if the button is disabled. ## Link Button ## Text Button Buttons without border and background. ## Icon Button Use icons to add more meaning to Button. You can use icon alone to save some space, or use it with text. ## Button Group Displayed as a button group, can be used to group a series of similar operations. In ^(2.11.9) you can use the `direction` attribute. ## Loading Button Click the button to load data, then the button displays a loading state. Set `loading` attribute to `true` to display loading state. ## Sizes Besides default size, Button component provides three additional sizes for you to choose among different scenarios. ## Tag ^(2.3.4) You can custom element tag, For example button, div, a, router-link, nuxt-link. ## Custom Color ^(beta) You can custom button color. We will calculate hover color & active color automatically. The `color` prop also works with `link` and `text` buttons since ^(2.13.7). ## Button API ### Button Attributes | Name | Description | Type | Default | | ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ | ------- | | size | button size | ^[enum]`'large' \| 'default' \| 'small'` | — | | type | button type, when setting `color`, the latter prevails | ^[enum]`'default' \| 'primary' \| 'success' \| 'warning' \| 'danger' \| 'info' \| '' \| 'text' (deprecated)` | — | | plain | determine whether it's a plain button | ^[boolean] | false | | text ^(2.2.0) | determine whether it's a text button | ^[boolean] | false | | bg ^(2.2.0) | determine whether the text button background color is always on | ^[boolean] | false | | link ^(2.2.1) | determine whether it's a link button | ^[boolean] | false | | round | determine whether it's a round button | ^[boolean] | false | | circle | determine whether it's a circle button | ^[boolean] | false | | dashed ^(2.13.3) | determine whether it's a dashed button | ^[boolean] | false | | loading | determine whether it's loading | ^[boolean] | false | | loading-icon | customize loading icon component | ^[string] / ^[Component] | Loading | | disabled | disable the button | ^[boolean] | false | | icon | icon component | ^[string] / ^[Component] | — | | autofocus | same as native button's `autofocus` | ^[boolean] | false | | native-type | same as native button's `type` | ^[enum]`'button' \| 'submit' \| 'reset'` | button | | auto-insert-space | automatically insert a space between two chinese characters(this will only take effect when the text length is 2 and all characters are in Chinese.) | ^[boolean] | false | | color | custom button color, automatically calculate `hover` and `active` color. Works with `link`/`text` buttons since ^(2.13.7) | ^[string] | — | | dark | dark mode, which automatically converts `color` to dark mode colors | ^[boolean] | false | | tag ^(2.3.4) | custom element tag | ^[string] / ^[Component] | button | ### Button Slots | Name | Description | | ------- | --------------------------- | | default | customize default content | | loading | customize loading component | | icon | customize icon component | ### Button Exposes | Name | Description | Type | | -------------- | -------------------- | -------------------------------------------------------------------------------------------------------------- | | ref | button html element | ^[object]`Ref` | | size | button size | ^[object]`ComputedRef<'' \| 'small' \| 'default' \| 'large'>` | | type | button type | ^[object]`ComputedRef<'' \| 'default' \| 'primary' \| 'success' \| 'warning' \| 'info' \| 'danger' \| 'text'>` | | disabled | button disabled | ^[object]`ComputedRef` | | shouldAddSpace | whether adding space | ^[object]`ComputedRef` | ## ButtonGroup API ### ButtonGroup Attributes | Name | Description | Type | Default | | ------------------- | ------------------------------------------------ | ------------------------------------------------------------------ | ---------- | | size | control the size of buttons in this button-group | ^[enum]`'large' \| 'default' \| 'small'` | — | | type | control the type of buttons in this button-group | ^[enum]`'primary' \| 'success' \| 'warning' \| 'danger' \| 'info'` | — | | direction ^(2.11.9) | display direction | ^[enum]`'horizontal' \| 'vertical'` | horizontal | ### ButtonGroup Slots | Name | Description | Subtags | | ------- | ------------------------------ | ------- | | default | customize button group content | Button | ## Vue Examples ### basic.vue ```vue ``` ### custom.vue ```vue ``` ### disabled.vue ```vue ``` ### group.vue ```vue ``` ### icon.vue ```vue ``` ### link.vue ```vue ``` ### loading.vue ```vue ``` ### size.vue ```vue ``` ### tag.vue ```vue ``` ### text.vue ```vue ``` --- Title: Calendar URL: https://element-plus.org/en-US/component/calendar --- # Calendar Display date. ## Basic ## Controller Type ^(2.13.1) ## Custom Content ## Range ## Customize header ## Localization The default locale of is English, if you need to use other languages, please check [Internationalization](/en-US/guide/i18n) Note, date time locale (month name, first day of the week ...) are also configured in localization. ## API ### Attributes | Name | Description | Type | Default | | ------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------- | | model-value / v-model | binding value | ^[Date] | — | | range | time range, including start time and end time. Start time must be start day of week, end time must be end day of week, the time span cannot exceed two months. | ^[array]`[Date, Date]` | — | | controller-type ^(2.13.1) | type of the controller for Calendar header | ^[enum]`'button' \| 'select'` | button | | formatter ^(2.13.1) | format label when `controller-type` is 'select' | ^[Function]`(value: number, type: 'year' \| 'month') => string \| number` | — | ### Slots | Name | Description | Type | | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | | date-cell | `type` indicates which month the date belongs, optional values are prev-month, current-month, next-month; `isSelected` indicates whether the date is selected; `day` is the formatted date in the format `YYYY-MM-DD`; `date` is date the cell represents | ^[object]`{ data: { type: 'prev-month' \| 'current-month' \| 'next-month', isSelected: boolean, day: string, date: Date } }` | | header | content of the Calendar header | ^[object]`{ date: string }` | ### Exposes | Name | Description | Type | | --------------------------- | ---------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | | selectedDay | currently selected date | ^[object]`ComputedRef` | | pickDay | select a specific date | ^[Function]`(day: dayjs.Dayjs) => void` | | selectDate | select date | ^[Function]`(type: CalendarDateType) => void` | | calculateValidatedDateRange | Calculate the validate date range according to the start and end dates | ^[Function]`(startDayjs: dayjs.Dayjs, endDayjs: dayjs.Dayjs) => [dayjs.Dayjs, dayjs.Dayjs][]` | ## Type Declarations
Show declarations ```ts type CalendarDateType = | 'prev-month' | 'next-month' | 'prev-year' | 'next-year' | 'today' ```
## Vue Examples ### basic.vue ```vue ``` ### controller-type.vue ```vue ``` ### customize.vue ```vue ``` ### header.vue ```vue ``` ### range.vue ```vue ``` --- Title: Card URL: https://element-plus.org/en-US/component/card --- # Card Integrate information in a card container. ## Basic usage Card includes title, content and operations. ## Simple card The header part can be omitted. ## With images Display richer content by adding some configs. ## Shadow You can define when to show the card shadows ## API ### Attributes | Name | Description | Type | Default | | --------------------- | -------------------------------------------------------------- | --------------------------------- | ------- | | header | title of the card. Also accepts a DOM passed by `slot#header` | ^[string] | — | | footer ^(2.4.3) | footer of the card. Also accepts a DOM passed by `slot#footer` | ^[string] | — | | body-style | CSS style of card body | ^[object]`CSSProperties` | — | | header-class ^(2.9.8) | custom class name of card header | ^[string] | — | | body-class ^(2.3.10) | custom class name of card body | ^[string] | — | | footer-class ^(2.9.8) | custom class name of card footer | ^[string] | — | | shadow | when to show card shadows | ^[enum]`always \| never \| hover` | always | ### Slots | Name | Description | | ------- | -------------------------- | | default | customize default content | | header | content of the Card header | | footer | content of the Card footer | ## Vue Examples ### basic.vue ```vue ``` ### shadow.vue ```vue ``` ### simple.vue ```vue ``` ### with-images.vue ```vue ``` --- Title: Carousel URL: https://element-plus.org/en-US/component/carousel --- # Carousel Loop a series of images or texts in a limited space ## Basic usage ## Motion blur ^(2.6.0) Add motion blur to infuse dynamism and smoothness into the carousel. ## Indicators Indicators can be displayed outside the carousel ## Arrows You can define when arrows are displayed ## Auto height When the `height` of `carousel` is set to `auto`, the `carousel` height will be automatically set according to the height of the `carousel item` ## Card mode When a page is wide enough but has limited height, you can activate card mode for carousels ## Vertical By default, `direction` is `horizontal`. Let carousel be displayed in the vertical direction by setting `direction` to `vertical`. ## Carousel API ### Carousel Attributes | Name | Description | Type | Default | | -------------------- | ----------------------------------------------------- | --------------------------------------- | ---------- | | height | height of the carousel | ^[string] | '' | | initial-index | index of the initially active slide (starting from 0) | ^[number] | 0 | | trigger | how indicators are triggered | ^[enum]`'hover' \| 'click'` | hover | | autoplay | whether automatically loop the slides | ^[boolean] | true | | interval | interval of the auto loop, in milliseconds | ^[number] | 3000 | | indicator-position | position of the indicators | ^[enum]`'' \| 'none' \| 'outside'` | '' | | arrow | when arrows are shown | ^[enum]`'always' \| 'hover' \| 'never'` | hover | | type | type of the Carousel | ^[enum]`'' \| 'card'` | '' | | card-scale ^(2.7.8) | when type is card, scaled size of secondary cards | ^[number] | 0.83 | | loop | display the items in loop | ^[boolean] | true | | direction | display direction | ^[enum]`'horizontal' \| 'vertical'` | horizontal | | pause-on-hover | pause autoplay when hover | ^[boolean] | true | | motion-blur ^(2.6.0) | infuse dynamism and smoothness into the carousel | ^[boolean] | false | ### Carousel Events | Name | Description | Type | | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------- | | change | triggers when the active slide switches, it has two parameters, the one is the index of the new active slide, and other is index of the old active slide | ^[Function]`(current: number, prev: number) => boolean` | ### Carousel Slots | Name | Description | Subtags | | ------- | ------------------------- | ------------- | | default | customize default content | Carousel-Item | ### Carousel Exposes | Method | Description | Type | | -------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------- | | activeIndex ^(2.7.8) | active slide index | ^[number] | | setActiveItem | manually switch slide, index of the slide to be switched to, starting from 0; or the `name` of corresponding `el-carousel-item` | ^[Function]`(index: string \| number) => void` | | prev | switch to the previous slide | ^[Function]`() => void` | | next | switch to the next slide | ^[Function]`() => void` | ## Carousel-Item API ### Carousel-Item Attributes | Name | Description | Type | Default | | ----- | ------------------------------------------------ | --------------------- | ------- | | name | name of the item, can be used in `setActiveItem` | ^[string] | '' | | label | text content for the corresponding indicator | ^[string] / ^[number] | '' | ### Carousel-Item Slots | Name | Description | | ------- | ------------------------- | | default | customize default content | ## Vue Examples ### arrows.vue ```vue ``` ### auto-height.vue ```vue ``` ### basic.vue ```vue ``` ### card.vue ```vue ``` ### indicator.vue ```vue ``` ### motion-blur.vue ```vue ``` ### vertical.vue ```vue ``` --- Title: Cascader URL: https://element-plus.org/en-US/component/cascader --- # Cascader If the options have a clear hierarchical structure, Cascader can be used to view and select them. ## Basic usage There are two ways to expand child option items. ## Disabled option Disable an option by setting a `disabled` field in the option object. ## Clearable Set `clearable` attribute for `el-cascader` and a clear icon will appear when selected and hovered ## Custom Clear Icon ^(2.11.0) You can customize the clear icon by setting the `clear-icon` attribute ## Display only the last level The input can display only the last level instead of all levels. ## Multiple Selection Add `:props="props"` in tag and set data `props = { multiple: true }` to use multiple selection. Do: ```vue ``` Don't do: ```vue ``` ## Select any level of options In single selection, only the leaf nodes can be checked, and in multiple selection, check parent nodes will lead to leaf nodes be checked eventually. When enable this feature, it can make parent and child nodes unlinked and you can select any level of options. ## Dynamic loading Dynamic load its child nodes when checked a node. ## Filterable Search and select options with a keyword. ## Custom option content You can customize the content of cascader node. ## Custom suggestion item ^(2.9.5) You can customize the filter suggestion item by `suggestion-item` slot. You'll have access to `item` in the scope, standing for the suggestion item. ## Cascader panel `CascaderPanel` is the core component of `Cascader` which has various of features such as single selection, multiple selection, dynamic loading and so on. ## Custom Tag ^(2.10.3) You can customize tags. ## Show Checked Strategy ^(2.10.5) Control how selected values are displayed in multiple selection mode. ## Click to Check Node ^(2.10.5) Only using `multiple` or `checkStrictly` attributes. You can add `checkOnClickNode` to be able to click on the node in addition with the prefix icon.\ Toggle the visibility of the prefix with `showPrefix`. ## Custom Header & Footer ^(2.10.5) You can customize both the header and footer of the dropdown using slots. ## Cascader API ### Cascader Attributes | Name | Description | Type | Default | | ------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | | model-value / v-model | binding value | ^[string] / ^[number] /^[array]`string[] \| number[] \| any` | — | | options | data of the options, the key of `value` and `label` can be customize by `CascaderProps`. | ^[array]`CascaderOption[]` | — | | [props](#cascaderprops) | configuration options, see the following `CascaderProps` table. | ^[object]`CascaderProps` | — | | size | size of input | ^[enum]`'large' \| 'default' \| 'small'` | — | | placeholder | placeholder of input | ^[string] | — | | disabled | whether Cascader is disabled | ^[boolean] | — | | clearable | whether selected value can be cleared | ^[boolean] | — | | clear-icon ^(2.11.0) | custom clear icon component | ^[string] / ^[object]`Component` | CircleClose | | show-all-levels | whether to display all levels of the selected value in the input | ^[boolean] | true | | collapse-tags | whether to collapse tags in multiple selection mode | ^[boolean] | — | | collapse-tags-tooltip | whether show all selected tags when mouse hover text of collapse-tags. To use this, `collapse-tags` must be true | ^[boolean] | false | | max-collapse-tags-tooltip-height ^(2.10.2) | max height of collapse-tags tooltip. | ^[string] / ^[number] | — | | separator | option label separator | ^[string] | ' / ' | | filterable | whether the options can be searched | ^[boolean] | — | | filter-method | customize search logic, the first parameter is `node`, the second is `keyword`, and need return a boolean value indicating whether it hits. | ^[Function]`(node: CascaderNode, keyword: string) => boolean` | — | | debounce | debounce delay when typing filter keyword, in milliseconds | ^[number] | 300 | | before-filter | hook function before filtering with the value to be filtered as its parameter. If `false` is returned or a `Promise` is returned and then is rejected, filtering will be aborted | ^[Function]`(value: string) => boolean` | — | | popper-class | custom class name for Cascader's dropdown and tags' tooltip | ^[string] | '' | | popper-style | custom style for Cascader's dropdown and tags' tooltip | ^[string] / ^[object] | — | | teleported | whether cascader popup is teleported | ^[boolean] | true | | effect ^(2.10.5) | tooltip theme, built-in theme: `dark` / `light` | ^[enum]`'dark' \| 'light'` / ^[string] | light | | tag-type | tag type | ^[enum]`'success' \| 'info' \| 'warning' \| 'danger'` | info | | tag-effect ^(2.7.8) | tag effect | ^[enum]`'light' \| 'dark' \| 'plain'` | light | | validate-event | whether to trigger form validation | ^[boolean] | true | | max-collapse-tags ^(2.3.10) | The max tags number to be shown. To use this, `collapse-tags` must be true | ^[number] | 1 | | empty-values ^(2.7.0) | empty values of component, [see config-provider](./config-provider.md#empty-values-configurations) | ^[array] | — | | value-on-clear ^(2.7.0) | clear return value, [see config-provider](./config-provider.md#empty-values-configurations) | ^[string] / ^[number] / ^[boolean] / ^[Function] | — | | persistent ^(2.7.8) | when dropdown is inactive and `persistent` is `false`, dropdown will be destroyed | ^[boolean] | true | | fallback-placements ^(2.8.1) | list of possible positions for Tooltip [popper.js](https://popper.js.org/docs/v2/modifiers/flip/#fallbackplacements) | ^[array]`Placement[]` | — | | placement ^(2.8.1) | position of dropdown | ^[enum]`'top' \| 'top-start' \| 'top-end' \| 'bottom' \| 'bottom-start' \| 'bottom-end' \| 'left' \| 'left-start' \| 'left-end' \| 'right' \| 'right-start' \| 'right-end'` | bottom-start | | popper-append-to-body ^(deprecated) | whether to append the popper menu to body. If the positioning of the popper is wrong, you can try to set this prop to false | ^[boolean] | true | | show-checked-strategy ^(2.10.5) | strategy for displaying checked nodes in multiple selection mode. Use `parent` when you want things tidy. Use `child` when every single item matters | ^[enum]`'parent' \| 'child'` | child | ### Cascader Events | Name | Description | Type | | -------------- | ------------------------------------------------------------- | ----------------------------------------------------------- | | change | triggers when the binding value changes | ^[Function]`(value: CascaderValue) => void` | | expand-change | triggers when expand option changes | ^[Function]`(value: CascaderValue) => void` | | blur | triggers when Cascader blurs | ^[Function]`(event: FocusEvent) => void` | | focus | triggers when Cascader focuses | ^[Function]`(event: FocusEvent) => void` | | clear ^(2.7.7) | triggers when the clear icon is clicked in a clearable Select | ^[Function]`() => void` | | visible-change | triggers when the dropdown appears/disappears | ^[Function]`(value: boolean) => void` | | remove-tag | triggers when remove tag in multiple selection mode | ^[Function]`(value: CascaderNode['valueByOption']) => void` | ### Cascader Slots | Name | Description | Type | | ------------------------ | ---------------------------------------------------------------------------------------------- | --------------------------------------------------------- | | default | the custom content of cascader node, which are current Node object and node data respectively. | ^[object]`{ node: any, data: any }` | | empty | content when there is no matched options. | — | | prefix ^(2.9.4) | content as Input prefix | — | | suggestion-item ^(2.9.5) | custom content for suggestion item when searching | ^[object]`{ item: CascaderNode }` | | tag ^(2.10.3) | custom tags style | ^[object]`{ data: Tag[], deleteTag: (tag: Tag) => void }` | | header ^(2.10.5) | content at the top of the dropdown | — | | footer ^(2.10.5) | content at the bottom of the dropdown | — | ### Cascader Exposes | Name | Description | Type | | ----------------------------- | ----------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------- | | getCheckedNodes | get an array of currently selected node,(leafOnly) whether only return the leaf checked nodes, default is `false` | ^[Function]`(leafOnly: boolean) => CascaderNode[] \| undefined` | | cascaderPanelRef | cascader panel ref | ^[object]`ComputedRef` | | togglePopperVisible ^(2.2.31) | toggle the visible type of popper | ^[Function]`(visible?: boolean) => void` | | contentRef | cascader content ref | ^[object]`ComputedRef` | | presentText ^(2.8.4) | selected content text | ^[object]`ComputedRef` | | focus ^(2.11.8) | focus the input element | ^[Function]`() => void` | | blur ^(2.11.8) | blur the input element | ^[Function]`() => void` | ## CascaderPanel API ### CascaderPanel Attributes | Name | Description | Type | Default | | ----------------------- | ---------------------------------------------------------------------------------------- | --------------------------------------------------------- | ------- | | model-value / v-model | binding value | ^[string]/^[number]/^[array]`string[] \| number[] \| any` | — | | options | data of the options, the key of `value` and `label` can be customize by `CascaderProps`. | ^[array]`CascaderOption[]` | — | | [props](#cascaderprops) | configuration options, see the following `CascaderProps` table. | ^[object]`CascaderProps` | — | ### CascaderPanel Events | Name | Description | Type | | ----------------- | ----------------------------------------------------------------------- | -------------------------------------------------------- | | change | triggers when the binding value changes | ^[Function]`(value: CascaderValue \| undefined) => void` | | update:modelValue | triggers when the binding value changes | ^[Function]`(value: CascaderValue \| undefined) => void` | | expand-change | triggers when expand option changes | ^[Function]`(value: CascaderNodePathValue) => void` | | close | close panel event, provided to Cascader to put away the panel judgment. | ^[Function]`() => void` | ### CascaderPanel Slots | Name | Description | Type | | -------------- | ---------------------------------------------------------------------------------------------- | ----------------------------------- | | default | the custom content of cascader node, which are current Node object and node data respectively. | ^[object]`{ node: any, data: any }` | | empty ^(2.8.3) | the content of the panel when there is no data. | — | ### CascaderPanel Exposes | Name | Description | Type | | ----------------- | ----------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------- | | getCheckedNodes | get an array of currently selected node,(leafOnly) whether only return the leaf checked nodes, default is `false` | ^[Function]`(leafOnly: boolean) => CascaderNode[] \| undefined` | | clearCheckedNodes | clear checked nodes | ^[Function]`() => void` | ## CascaderProps | Attribute | Description | Type | Default | | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------- | -------- | | expandTrigger | trigger mode of expanding options | ^[enum]`'click' \| 'hover'` | click | | multiple | whether multiple selection is enabled | ^[boolean] | false | | checkStrictly | whether checked state of a node not affects its parent and child nodes | ^[boolean] | false | | emitPath | when checked nodes change, whether to emit an array of node's path, if false, only emit the value of node. | ^[boolean] | true | | lazy | whether to dynamic load child nodes, use with `lazyload` attribute | ^[boolean] | false | | lazyLoad | method for loading child nodes data, only works when `lazy` is true. The reject parameter is supported after version ^(2.11.5). | ^[Function]`(node: Node, resolve: Resolve, reject: () => void) => void` | — | | value | specify which key of node object is used as the node's value | ^[string] | value | | label | specify which key of node object is used as the node's label | ^[string] | label | | children | specify which key of node object is used as the node's children | ^[string] | children | | disabled | specify which key of node object is used as the node's disabled | ^[string] | disabled | | leaf | specify which key of node object is used as the node's leaf field | ^[string] | leaf | | hoverThreshold | hover threshold of expanding options | ^[number] | 500 | | checkOnClickNode ^(2.10.5) | whether to check or uncheck node when clicking on the node | ^[boolean] | false | | checkOnClickLeaf ^(2.10.5) | whether to check or uncheck node when clicking on leaf node (last children). | ^[boolean] | true | | showPrefix ^(2.10.5) | whether to show the radio or checkbox prefix | ^[boolean] | true | ## Type Declarations
Show declarations ```ts type CascaderNodeValue = string | number type CascaderNodePathValue = CascaderNodeValue[] type CascaderValue = | CascaderNodeValue | CascaderNodePathValue | (CascaderNodeValue | CascaderNodePathValue)[] type Resolve = (data: any) => void type ExpandTrigger = 'click' | 'hover' type LazyLoad = (node: Node, resolve: Resolve, reject: () => void) => void type isDisabled = (data: CascaderOption, node: Node) => boolean type isLeaf = (data: CascaderOption, node: Node) => boolean interface CascaderOption extends Record { label?: string value?: CascaderNodeValue children?: CascaderOption[] disabled?: boolean leaf?: boolean } interface CascaderProps { expandTrigger?: ExpandTrigger multiple?: boolean checkStrictly?: boolean emitPath?: boolean lazy?: boolean lazyLoad?: LazyLoad value?: string label?: string children?: string disabled?: string | isDisabled leaf?: string | isLeaf hoverThreshold?: number } class Node { readonly uid: number readonly level: number readonly value: CascaderNodeValue readonly label: string readonly pathNodes: Node[] readonly pathValues: CascaderNodePathValue readonly pathLabels: string[] childrenData: ChildrenData children: Node[] text: string loaded: boolean /** * Is it checked * * @default false */ checked: boolean /** * Used to indicate the intermediate state of unchecked and fully checked child nodes * * @default false */ indeterminate: boolean /** * Loading Status * * @default false */ loading: boolean // getter isDisabled: boolean isLeaf: boolean valueByOption: CascaderNodeValue | CascaderNodePathValue // method appendChild(childData: CascaderOption): Node calcText(allLevels: boolean, separator: string): string broadcast(): void emit(): void onParentCheck(checked: boolean): void onChildCheck(): void setCheckState(checked: boolean): void doCheck(checked: boolean): void } Node as CascaderNode ```
## Vue Examples ### any-level.vue ```vue ``` ### basic.vue ```vue ``` ### check-on-click-node.vue ```vue ``` ### clear-icon.vue ```vue ``` ### clearable.vue ```vue ``` ### custom-content.vue ```vue ``` ### custom-header-footer.vue ```vue ``` ### custom-suggestion-item.vue ```vue ``` ### custom-tag.vue ```vue ``` ### dynamic-loading.vue ```vue ``` ### filterable.vue ```vue ``` ### last-level.vue ```vue ``` ### multiple-selection.vue ```vue ``` ### option-disabling.vue ```vue ``` ### panel.vue ```vue ``` ### show-checked-strategy.vue ```vue ``` --- Title: Checkbox URL: https://element-plus.org/en-US/component/checkbox --- # Checkbox A group of options for multiple choices. ```vue ``` ## Basic usage Checkbox can be used alone to switch between two states. ## Disabled State Disabled state for checkbox. ## Checkbox group It is used for multiple checkboxes which are bound in one group, and indicates whether one option is selected by checking if it is checked. ## Options attribute ^(2.11.2) ## Indeterminate The `indeterminate` property can help you to achieve a 'check all' effect. ## Minimum / Maximum items checked The `min` and `max` properties can help you to limit the number of checked items. ## Button style Checkbox with button styles. ## With borders ## Checkbox API ### Checkbox Attributes | Name | Description | Type | Default | | ------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------- | ------- | | model-value / v-model | binding value | ^[string] / ^[number] / ^[boolean] | — | | value ^(2.6.0) | value of the Checkbox when used inside a `checkbox-group` | ^[string] / ^[number] / ^[boolean] / ^[object] | — | | label | label of the Checkbox when used inside a `checkbox-group`. If there's no value, `label` will act as `value` | ^[string] / ^[number] / ^[boolean] / ^[object] | — | | true-value ^(2.6.0) | value of the Checkbox if it's checked | ^[string] / ^[number] | — | | false-value ^(2.6.0) | value of the Checkbox if it's not checked | ^[string] / ^[number] | — | | disabled | whether the Checkbox is disabled | ^[boolean] | false | | border | whether to add a border around Checkbox | ^[boolean] | false | | size | size of the Checkbox | ^[enum]`'large' \| 'default' \| 'small'` | — | | name | native 'name' attribute | ^[string] | — | | checked | if the Checkbox is checked | ^[boolean] | false | | indeterminate | Set indeterminate state, only responsible for style control | ^[boolean] | false | | validate-event | whether to trigger form validation | ^[boolean] | true | | tabindex | input tabindex | ^[string] / ^[number] | — | | id | input id | ^[string] | — | | aria-controls ^(a11y) ^(2.7.2) | same as [aria-controls](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-controls), takes effect when `indeterminate` is `true` | ^[string] | — | | aria-label ^(a11y) | native `aria-label` attribute | ^[string] | — | | true-label ^(deprecated) | value of the Checkbox if it's checked | ^[string] / ^[number] | — | | false-label ^(deprecated) | value of the Checkbox if it's not checked | ^[string] / ^[number] | — | | controls ^(a11y) ^(deprecated) | same as [aria-controls](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-controls), takes effect when `indeterminate` is `true` | ^[string] | — | ### Checkbox Events | Name | Description | Type | | ------ | --------------------------------------- | --------------------------------------------------------- | | change | triggers when the binding value changes | ^[Function]`(value: string \| number \| boolean) => void` | ### Checkbox Slots | Name | Description | | ------- | ------------------------- | | default | customize default content | ## CheckboxGroup API ### CheckboxGroup Attributes | Name | Description | Type | Default | | --------------------------- | ---------------------------------------------------------------------------------------------- | --------------------------------------------------------------- | -------------------------------------------------------- | | model-value / v-model | binding value | ^[array]`string[] \| number[]` | [] | | size | size of checkbox | ^[enum]`'large' \| 'default' \| 'small'` | — | | disabled | whether the nesting checkboxes are disabled | ^[boolean] | false | | min | minimum number of checkbox checked | ^[number] | — | | max | maximum number of checkbox checked | ^[number] | — | | aria-label ^(a11y) ^(2.7.2) | native `aria-label` attribute | ^[string] | — | | text-color | font color when button is active | ^[string] | #ffffff | | fill | border and background color when button is active | ^[string] | #409eff | | tag | element tag of the checkbox group | ^[string] | div | | validate-event | whether to trigger form validation | ^[boolean] | true | | label ^(a11y) ^(deprecated) | native `aria-label` attribute | ^[string] | — | | options ^(2.11.2) | data of the options, the key of `value` and `label` and `disabled` can be customize by `props` | ^[array]`Array<{[key: string]: any}>` | — | | props ^(2.11.2) | configuration options | ^[object]`{ value?: string, label?: string, disabled?: string}` | `{value: 'value', label: 'label', disabled: 'disabled'}` | | type ^(2.11.5) | component type to render options (e.g. `'button'`) | ^[enum]`'checkbox' \| 'button'` | 'checkbox' | ### CheckboxGroup Events | Name | Description | Type | | ------ | --------------------------------------- | -------------------------------------------------- | | change | triggers when the binding value changes | ^[Function]`(value: string[] \| number[]) => void` | ### CheckboxGroup Slots | Name | Description | Subtags | | ------- | ------------------------- | -------------------------- | | default | customize default content | Checkbox / Checkbox-button | ## CheckboxButton API ### CheckboxButton Attributes | Name | Description | Type | Default | | ------------------------- | ----------------------------------------------------------------------------------------------------------- | ---------------------------------------------- | ------- | | value ^(2.6.0) | value of the checkbox when used inside a `checkbox-group` | ^[string] / ^[number] / ^[boolean] / ^[object] | — | | label | label of the checkbox when used inside a `checkbox-group`. If there's no value, `label` will act as `value` | ^[string] / ^[number] / ^[boolean] / ^[object] | — | | true-value ^(2.6.0) | value of the checkbox if it's checked | ^[string] / ^[number] | — | | false-value ^(2.6.0) | value of the checkbox if it's not checked | ^[string] / ^[number] | — | | disabled | whether the checkbox is disabled | ^[boolean] | false | | name | native 'name' attribute | ^[string] | — | | checked | if the checkbox is checked | ^[boolean] | false | | true-label ^(deprecated) | value of the checkbox if it's checked | ^[string] / ^[number] | — | | false-label ^(deprecated) | value of the checkbox if it's not checked | ^[string] / ^[number] | — | ### CheckboxButton Slots | Name | Description | | ------- | ------------------------- | | default | customize default content | ## Vue Examples ### basic.vue ```vue ``` ### button-style.vue ```vue ``` ### disabled.vue ```vue ``` ### grouping.vue ```vue ``` ### intermediate.vue ```vue ``` ### limitation.vue ```vue ``` ### options.vue ```vue ``` ### with-border.vue ```vue ``` --- Title: Collapse URL: https://element-plus.org/en-US/component/collapse --- # Collapse Use Collapse to store contents. ## Basic usage You can expand multiple panels ## Accordion In accordion mode, only one panel can be expanded at once ## Custom title Besides using the `title` attribute, you can customize panel title with named slots, which makes adding custom content, e.g. icons, possible. ## Custom icon ^(2.8.3) Besides using the `icon` attribute, you can customize icon of panel item with named slots, which makes adding custom content. ## Custom icon position ^(2.9.10) using the `expand-icon-position` attribute, you can customize icon position. ## Prevent collapsing ^(2.9.11) set the `before-collapse` property, If `false` is returned or a `Promise` is returned and then is rejected, will stop collapsing. ## Collapse API ### Collapse Attributes | Name | Description | Type | Default | | ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------- | ------- | | model-value / v-model | currently active panel, the type is `string` in accordion mode, otherwise it is `array` | ^[string] / ^[array] | [] | | accordion | whether to activate accordion mode | ^[boolean] | false | | expand-icon-position ^(2.9.10) | set expand icon position | ^[enum]`'left' \| 'right' ` | right | | before-collapse ^(2.9.11) | before-collapse hook before the collapse state changes. If `false` is returned or a `Promise` is returned and then is rejected, will stop collapsing | ^[Function]`() => Promise \| boolean` | — | ### Collapse Events | Name | Description | Type | | ------ | ------------------------------------------------------------------------------------------------------------- | --------------------------------------------------- | | change | triggers when active panels change, the parameter type is `string` in accordion mode, otherwise it is `array` | ^[Function]`(activeNames: array \| string) => void` | ### Collapse Slots | Name | Description | Subtags | | ------- | ------------------------- | ------------- | | default | customize default content | Collapse Item | ### Collapse Exposes | Name | Description | Type | | -------------- | ---------------------------- | -------------------------------------------------------- | | activeNames | currently active panel names | ^[object]`ComputedRef<(string \| number)[]>` | | setActiveNames | set active panel names | ^[Function]`(activeNames: (string \| number)[]) => void` | ## Collapse Item API ### Collapse Item Attributes | Name | Description | Type | Default | | ------------- | ---------------------------------- | ------------------------ | ---------- | | name | unique identification of the panel | ^[string] / ^[number] | — | | title | title of the panel | ^[string] | '' | | icon ^(2.8.3) | icon of the collapse item | ^[string] / ^[Component] | ArrowRight | | disabled | disable the collapse item | ^[boolean] | false | ### Collapse Item Slot | Name | Description | Type | | ------------- | ------------------------------ | -------------------------------- | | default | content of Collapse Item | — | | title | content of Collapse Item title | ^[object]`{ isActive: boolean }` | | icon ^(2.8.3) | content of Collapse Item icon | ^[object]`{ isActive: boolean }` | ### Collapse Item Exposes | Name | Description | Type | | -------- | ------------------------------------------- | -------------------------------------------- | | isActive | whether the current collapse item is active | ^[object]`ComputedRef` | ## Vue Examples ### accordion.vue ```vue ``` ### basic.vue ```vue ``` ### custom-icon-position.vue ```vue ``` ### custom-icon.vue ```vue ``` ### customization.vue ```vue ``` ### prevent-collapsing.vue ```vue ``` --- Title: ColorPickerPanel URL: https://element-plus.org/en-US/component/color-picker-panel --- # ColorPickerPanel ^(beta) `ColorPickerPanel` is the core component of `ColorPicker`. ## Basic usage ## Alpha ## Predefined colors ## Border By default the color-picker-panel is bordered but in some case you don't want it. ## Disabled The `disabled` attribute determines if the color picker is fully disabled. ## API ### Attributes | Name | Description | Type | Default | | -------------------------- | ------------------------------------------ | ----------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | | model-value / v-model | binding value | ^[string] | — | | border | whether the color picker panel is bordered | ^[boolean] | true | | disabled | whether to disable the color picker | ^[boolean] | false | | show-alpha | whether to display the alpha slider | ^[boolean] | false | | color-format | color format of v-model | ^[enum]`'rgb' \| 'prgb' \| 'hex' \| 'hex3' \| 'hex4' \| 'hex6' \| 'hex8' \| 'name' \| 'hsl' \| 'hsv'` | ^[enum]`'hex' (when show-alpha is false) \| 'rgb' (when show-alpha is true)` | | predefine | predefined color options | ^[array]`string[]` | — | | validate-event ^(2.11.7) | whether to trigger form validation | ^[boolean] | true | | hue-slider-class ^(2.13.6) | class names will be passed to hue-slider | ^[object]`string \| string[] \| Record` | — | | hue-slider-style ^(2.13.6) | styles will be passed to hue-slider | ^[string] / ^[object]`StyleValue` | — | ### Slots | Name | Description | | ------ | --------------------------------- | | footer | content to append after the Input | ### Exposes | Name | Description | Type | | ---------------- | --------------------- | ------------------------ | | color | current color object | ^[object]`Color` | | inputRef | custom input ref | ^[object]`InputInstance` | | update ^(2.11.4) | update sub components | ^[Function]`() => void` | ## Vue Examples ### alpha.vue ```vue ``` ### basic.vue ```vue ``` ### border.vue ```vue ``` ### disabled.vue ```vue ``` ### predefined-color.vue ```vue ``` --- Title: ColorPicker URL: https://element-plus.org/en-US/component/color-picker --- # ColorPicker ColorPicker is a color selector supporting multiple color formats. ## Basic usage ## Alpha ## Predefined colors ## Sizes ## API ### Attributes | Name | Description | Type | Default | | --------------------------- | -------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | | model-value / v-model | binding value | ^[string] | — | | disabled | whether to disable the ColorPicker | ^[boolean] | false | | clearable ^(2.13.1) | whether to show clear button | ^[boolean] | true | | size | size of ColorPicker | ^[enum]`'large' \| 'default' \| 'small'` | — | | show-alpha | whether to display the alpha slider | ^[boolean] | false | | color-format | color format of v-model | ^[enum]`'rgb' \| 'prgb' \| 'hex' \| 'hex3' \| 'hex4' \| 'hex6' \| 'hex8' \| 'name' \| 'hsl' \| 'hsv'` | ^[enum]`'hex' (when show-alpha is false) \| 'rgb' (when show-alpha is true)` | | popper-class | custom class name for ColorPicker's dropdown | ^[string] / ^[object] | '' | | popper-style ^(2.11.4) | custom style for ColorPicker's dropdown | ^[string] / ^[object] | — | | predefine | predefined color options | ^[array]`string[]` | — | | validate-event | whether to trigger form validation | ^[boolean] | true | | tabindex | ColorPicker tabindex | ^[string] / ^[number] | 0 | | aria-label ^(a11y) ^(2.7.2) | ColorPicker aria-label | ^[string] | — | | empty-values ^(2.10.3) | empty values of component, [see config-provider](./config-provider.md#empty-values-configurations) | ^[array] | — | | value-on-clear ^(2.10.3) | clear return value, [see config-provider](./config-provider.md#empty-values-configurations) | ^[string] / ^[number] / ^[boolean] / ^[Function] | — | | id | ColorPicker id | ^[string] | — | | teleported ^(2.7.2) | whether color-picker popper is teleported to the body | ^[boolean] | true | | label ^(a11y) ^(deprecated) | ColorPicker aria-label | ^[string] | — | | persistent ^(2.10.5) | when color-picker inactive and persistent is false, the color panel will be destroyed | ^[boolean] | true | | append-to ^(2.10.5) | which element the color-picker panel appends to | ^[CSSSelector] / ^[HTMLElement] | - | ### Events | Name | Description | Type | | --------------- | ---------------------------------------------- | ---------------------------------------- | | change | triggers when input value changes | ^[Function]`(value: string) => void` | | active-change | triggers when the current active color changes | ^[Function]`(value: string) => void` | | focus ^(2.4.0) | triggers when Component focuses | ^[Function]`(event: FocusEvent) => void` | | blur ^(2.4.0) | triggers when Component blurs | ^[Function]`(event: FocusEvent) => void` | | clear ^(2.13.1) | triggers when the clear button is clicked | ^[Function]`() => void` | ### Exposes | Name | Description | Type | | --------------- | ------------------------- | ----------------------- | | color | current color object | ^[object]`Color` | | show ^(2.3.3) | manually show ColorPicker | ^[Function]`() => void` | | hide ^(2.3.3) | manually hide ColorPicker | ^[Function]`() => void` | | focus ^(2.3.13) | focus the picker element | ^[Function]`() => void` | | blur ^(2.3.13) | blur the picker element | ^[Function]`() => void` | ## Vue Examples ### alpha.vue ```vue ``` ### basic.vue ```vue ``` ### predefined-color.vue ```vue ``` ### sizes.vue ```vue ``` --- Title: Color URL: https://element-plus.org/en-US/component/color --- # Color Element Plus uses a specific set of palettes to specify colors to provide a consistent look and feel for the products you build. ## Main Color The main color of Element Plus is bright and friendly blue. ## Secondary Color Besides the main color, you need to use different scene colors in different scenarios (for example, dangerous color indicates dangerous operation) ## Neutral Color Neutral colors are for text, background and border colors. You can use different neutral colors to represent the hierarchical structure. --- Title: Config Provider URL: https://element-plus.org/en-US/component/config-provider --- # Config Provider Config Provider is used for providing global configurations, which enables your entire application to access these configurations everywhere. ## i18n Configurations Configure i18n related properties via Config Provider, to get language switching feature. ## Button Configurations ## Link Configurations ^(2.9.11) ## Card Configurations ^(2.10.5) ## Dialog Configurations ^(2.10.7) ## Message Configurations ## Empty Values Configurations ^(2.7.0)
Supported components list - Cascader - ColorPicker ^(2.10.3) - DatePicker - Select - SelectV2 - TimePicker - TimeSelect - TreeSelect
Set `empty-values` to support empty values of components. The fallback value is `['', null, undefined]`. If you think the empty string is meaningful, write `[undefined, null]`. Set `value-on-clear` to set the return value when cleared. The fallback value is `undefined`. In the date component is `null`. If you want to set `undefined`, use `() => undefined`. ## Table Configurations ^(2.13.3) ## Experimental features In this section, you can learn how to use Config Provider to provide experimental features. For now, we haven't added any experimental features, but in the feature roadmap, we will add some experimental features. You can use this config to manage the features you want or not. ## API ### Config Provider Attributes | Name | Description | Type | Default | | ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | | locale | Locale Object | ^[object]`{name: string, el: TranslatePair}`[](https://github.com/element-plus/element-plus/blob/a98ff9b40c0c3d2b9959f99919bd8363e3e3c25a/packages/locale/index.ts#L5) [languages](https://github.com/element-plus/element-plus/tree/dev/packages/locale/lang) | [en](https://github.com/element-plus/element-plus/blob/dev/packages/locale/lang/en.ts) | | size | global component size | ^[enum]`'large' \| 'default' \| 'small'` | default | | zIndex | global Initial zIndex | ^[number] | — | | namespace | global component className prefix (cooperated with [$namespace](https://github.com/element-plus/element-plus/blob/dev/packages/theme-chalk/src/mixins/config.scss#L1)) | ^[string] | el | | button | button related configuration, [see the following table](#button-attribute) | ^[object]`{autoInsertSpace?: boolean, type?: string, plain?: boolean, text?: boolean, round?: boolean, dashed?: boolean}` | see the following table | | link | link related configuration, [see the following table](#link-attribute) | ^[object]`{type?: string, underline?: boolean \| string}` | see the following table | | dialog ^(2.10.7) | dialog related configuration, [see the following table](#dialog-attribute) | ^[object]`{alignCenter?: boolean, draggable?: boolean, overflow?: boolean, transition?: DialogTransition}` | see the following table | | message | message related configuration, [see the following table](#message-attribute) | ^[object]`{max?: number}` | see the following table | | experimental-features | features at experimental stage to be added, all features are default to be set to false | ^[object] | — | | empty-values ^(2.7.0) | global empty values of components | ^[array] | — | | value-on-clear ^(2.7.0) | global clear return value | ^[string] / ^[number] / ^[boolean] / ^[Function] | — | | table ^(2.13.3) | table related configuration, [see the following table](#table-attribute) | ^[object]`{showOverflowTooltip?: boolean \| object, tooltipEffect?: string, tooltipOptions?: object, tooltipFormatter?: Function}` | see the following table | ### Button Attribute | Attribute | Description | Type | Default | | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ------- | | type ^(2.9.11) | button type, when setting `color`, the latter prevails | ^[enum]`'primary' \| 'success' \| 'warning' \| 'danger' \| 'info' \| 'text' (deprecated)` | — | | autoInsertSpace | automatically insert a space between two chinese characters(this will only take effect when the text length is 2 and all characters are in Chinese.) | ^[boolean] | false | | plain ^(2.9.11) | determine whether it's a plain button | ^[boolean] | false | | text ^(2.11.0) | determine whether it's a text button | ^[boolean] | false | | round ^(2.9.11) | determine whether it's a round button | ^[boolean] | false | | dashed ^(2.13.3) | determine whether it's a dashed button | ^[boolean] | false | ### Link Attribute | Attribute | Description | Type | Default | | ------------------- | ----------------------------- | ------------------------------------------------------------------------------- | ------- | | type ^(2.9.11) | type | ^[enum]`'primary' \| 'success' \| 'warning' \| 'danger' \| 'info' \| 'default'` | default | | underline ^(2.9.11) | when underlines should appear | ^[enum]`'always' \| 'hover' \| 'never' \| boolean` | hover | ### Card Attribute | Attribute | Description | Type | Default | | ---------------- | ------------------------- | --------------------------------- | ------- | | shadow ^(2.10.5) | when to show card shadows | ^[enum]`always \| never \| hover` | — | ### Dialog Attribute | Attribute | Description | Type | Default | | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------- | ------- | | align-center ^(2.10.7) | whether to align the dialog both horizontally and vertically | ^[boolean] | false | | draggable ^(2.10.7) | enable dragging feature for Dialog | ^[boolean] | false | | overflow ^(2.10.7) | draggable Dialog can overflow the viewport long | ^[boolean] | false | | transition ^(2.10.7) | custom transition configuration for dialog animation. Can be a string (transition name) or an object with Vue transition props | ^[string] / ^[object]`TransitionProps` | — | ### Message Attribute | Attribute | Description | Type | Default | | ------------------- | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------- | | max | the maximum number of messages that can be displayed at the same time | ^[number] | — | | grouping ^(2.8.2) | merge messages with the same content, type of VNode message is not supported | ^[boolean] | — | | duration ^(2.8.2) | display duration, millisecond. If set to 0, it will not turn off automatically | ^[number] | — | | showClose ^(2.8.2) | whether to show a close button | ^[boolean] | — | | offset ^(2.8.2) | set the distance to the top of viewport | ^[number] | — | | plain ^(2.9.11) | whether message is plain | ^[boolean] | — | | placement ^(2.11.0) | message placement position | ^[enum]`'top' \| 'top-left' \| 'top-right' \| 'bottom' \| 'bottom-left' \| 'bottom-right'` | — | ### Table Attribute ^(2.13.3) | Attribute | Description | Type | Default | | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | | show-overflow-tooltip | whether to hide extra content and show them in a tooltip when hovering on the cell.It will affect all the table columns, refer to table tooltip-options | ^[boolean] / [`object`] | — | | tooltip-effect | the `effect` of the overflow tooltip | ^[enum]`'dark' \| 'light'` | dark | | tooltip-options | the options for the overflow tooltip, [see the following tooltip component](tooltip.html#attributes) | ^[object]`Pick` | ^[object]`{ enterable: true, placement: 'top', showArrow: true, hideAfter: 200, popperOptions: { strategy: 'fixed' } }` | | tooltip-formatter | customize tooltip content when using `show-overflow-tooltip` | ^[Function]`(data: { row: any, column: TableColumnCtx, cellValue: any }) => VNode \| string` | — | ### Config Provider Slots | Name | Description | Type | | ------- | ------------------------- | ------------------------------------------------------- | | default | customize default content | config: provided global config (inherited from the top) | ## Vue Examples ### button.vue ```vue ``` ### card.vue ```vue ``` ### dialog.vue ```vue ``` ### empty-values.vue ```vue ``` ### link.vue ```vue ``` ### message.vue ```vue ``` ### table.vue ```vue ``` ### usage.vue ```vue ``` --- Title: Container URL: https://element-plus.org/en-US/component/container --- # Container Container components for scaffolding basic structure of the page: ``: wrapper container. When nested with a `` or ``, all its child elements will be vertically arranged. Otherwise horizontally. ``: container for headers. ``: container for side sections (usually a side nav). ``: container for main sections. ``: container for footers. ## Common layouts ## Example ## Container API ### Container Attributes | Name | Description | Type | Default | | --------- | ----------------------------------- | ----------------------------------- | -------------------------------------------------------------------------- | | direction | layout direction for child elements | ^[enum]`'horizontal' \| 'vertical'` | vertical when nested with `el-header` or `el-footer`; horizontal otherwise | ### Container Slots | Name | Description | Subtags | | ------- | ------------------------- | ------------------------------------------ | | default | customize default content | Container / Header / Aside / Main / Footer | ## Header API ### Header Attributes | Name | Description | Type | Default | | ------ | -------------------- | --------- | ------- | | height | height of the header | ^[string] | 60px | ### Header Slots | Name | Description | | ------- | ------------------------- | | default | customize default content | ## Aside API ### Aside Attributes | Name | Description | Type | Default | | ----- | ------------------------- | --------- | ------- | | width | width of the side section | ^[string] | 300px | ### Aside Slots | Name | Description | | ------- | ------------------------- | | default | customize default content | ## Main API ### Main Slots | Name | Description | | ------- | ------------------------- | | default | customize default content | ## Footer API ### Footer Attributes | Name | Description | Type | Default | | ------ | -------------------- | --------- | ------- | | height | height of the footer | ^[string] | 60px | ### Footer Slots | Name | Description | | ------- | ------------------------- | | default | customize default content | ## Vue Examples ### example.vue ```vue ``` ### layout-ahm.vue ```vue ``` ### layout-ahmf.vue ```vue ``` ### layout-am.vue ```vue ``` ### layout-ham.vue ```vue ``` ### layout-hamf.vue ```vue ``` ### layout-hm.vue ```vue ``` ### layout-hmf.vue ```vue ``` --- Title: DatePickerPanel URL: https://element-plus.org/en-US/component/date-picker-panel --- # DatePickerPanel ^(beta) `DatePickerPanel` is the core component of `DatePicker`. ## Enter Date Basic date picker measured by 'day'. ## Border By default the date-picker-panel is bordered but in some case you don't want it. For example `DatePicker` don't inherit `border`. ## Disabled The `disabled` attribute determines if the date picker is fully disabled. ## Types The measurement is determined by the `type` attribute. ## Localization The default locale of is English, if you need to use other languages, please check [Internationalization](/en-US/guide/i18n) Note, date time locale (month name, first day of the week ...) are also configured in localization. ## API ### Attributes | Name | Description | Type | Default | | --------------------- | ---------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- | | model-value / v-model | binding value, if it is an `range` picker, the length of the array should be 2 | ^[number] / ^[string] / ^[Date] / ^[array]`number[] \| string[] \| Date[]` | '' | | border | whether the date picker is bordered | ^[boolean] | true | | disabled | whether DatePicker is disabled | ^[boolean] | false | | clearable | whether to show clear button | ^[boolean] | true | | editable ^(2.13.0) | whether the input is editable | ^[boolean] | true | | type | type of the picker | ^[enum]`'year' \| 'years' \|'month' \| 'months' \| 'date' \| 'dates' \| 'datetime' \| 'week' \| 'datetimerange' \| 'daterange' \| 'monthrange' \| 'yearrange'` | date | | default-value | optional, default date of the calendar | ^[object]`Date \| [Date, Date]` | — | | default-time | optional, the time value to use when selecting date range | ^[object]`Date \| [Date, Date]` | — | | value-format | optional, format of binding value. If not specified, the binding value will be a Date object | ^[string] | — | | date-format | optional, format of the date displayed in input's inner panel | ^[string] see [date formats](https://day.js.org/docs/en/display/format) | YYYY-MM-DD | | time-format | optional, format of the time displayed in input's inner panel | ^[string] see [date formats](https://day.js.org/docs/en/display/format) | HH:mm:ss | | unlink-panels | unlink two date-panels in range-picker | ^[boolean] | false | | disabled-date | a function determining if a date is disabled with that date as its parameter. Should return a Boolean | ^[Function]`(data: Date) => boolean` | — | | shortcuts | an object array to set shortcut options | ^[array]`Array<{ text: string, value: Date \| Function }>` | [] | | cell-class-name | set custom className | ^[Function]`(data: Date) => string` | — | | show-footer | whether to show footer where the date picker is one ^[enum]`'dates' \| 'months' \| 'years' \| 'datetime' \| 'datetimerange'` | ^[boolean] | false | | show-confirm | whether to show the confirm button | ^[boolean] | false | | show-week-number | show the week number besides the week | ^[boolean] | false | ### Events | Name | Description | Type | | --------------- | --------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | calendar-change | triggers when the calendar selected date is changed. Only for `range` | ^[Function]`(val: [Date, null \| Date]) => void` | | panel-change | triggers when the navigation button click. | ^[Function]`(date: Date \| [Date, Date], mode: 'month' \| 'year', view?: string) => void` | | clear ^(2.13.1) | triggers when a clear button is clicked | ^[Function]`() => void` | ### Slots | Name | Description | | ---------- | ------------------- | | default | custom cell content | | prev-month | prev month icon | | next-month | next month icon | | prev-year | prev year icon | | next-year | next year icon | ## Vue Examples ### all-types.vue ```vue ``` ### basic.vue ```vue ``` ### border.vue ```vue ``` ### disabled.vue ```vue ``` --- Title: DatePicker URL: https://element-plus.org/en-US/component/date-picker --- # DatePicker Use Date Picker for date input. ## Enter Date Basic date picker measured by 'day'. ## Other measurements You can choose week, month, year or multiple dates by extending the standard date picker component. ## Date Range Picking a date range is supported. ## Month Range Picking a month range is supported. ## Year Range ^(2.8.0) Picking a year range is supported. ## Default Value If user hasn't picked a date, shows today's calendar by default. You can use `default-value` to set another date. Its value should be parsable by `new Date()`. If type is `daterange`, `default-value` sets the left side calendar. ## Date Formats Use `format` to control displayed text's format in the input box. Use `value-format` to control binding value's format. By default, the component accepts and emits a `Date` object. Check the list [here](https://day.js.org/docs/en/display/format#list-of-all-available-formats) of all available formats of Day.js. ## Default time for start date and end date When picking a date range, you can assign the time part for start date and end date. ## Set custom content of prefix The content of prefix can be customized. ## Custom content The content of cell can be customized, in scoped-slot you can get the cell data. Note that the custom content structure should be consistent with the default structure, otherwise style misalignment may occur. ## Custom icon ^(2.8.0) Custom icons available with slots. For data details, please refer: ```ts interface DateCell { column: number customClass: string | undefined disabled: boolean end: boolean inRange: boolean row: number selected: Dayjs | undefined isCurrent: boolean | undefined isSelected: boolean renderText: string | undefined start: boolean text: number timestamp: number date: Date dayjs: Dayjs type: 'normal' | 'today' | 'week' | 'next-month' | 'prev-month' } ``` ## Localization The default locale of is English, if you need to use other languages, please check [Internationalization](/en-US/guide/i18n) Note, date time locale (month name, first day of the week ...) are also configured in localization. ## API ### Attributes | Name | Description | Type | Default | | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------- | | model-value / v-model | binding value, if it is an `range` picker, the length of the array should be 2 | ^[number] / ^[string] / ^[Date] / ^[array]`number[] \| string[] \| Date[]` | '' | | readonly | whether DatePicker is read only | ^[boolean] | false | | disabled | whether DatePicker is disabled | ^[boolean] | false | | size | size of Input | ^[enum]`'' \| 'large' \| 'default' \| 'small'` | — | | editable | whether the input is editable | ^[boolean] | true | | clearable | whether to show clear button | ^[boolean] | true | | placeholder | placeholder in non-range mode | ^[string] | '' | | start-placeholder | placeholder for the start date in range mode | ^[string] | — | | end-placeholder | placeholder for the end date in range mode | ^[string] | — | | type | type of the picker | ^[enum]`'year' \| 'years' \|'month' \| 'months' \| 'date' \| 'dates' \| 'datetime' \| 'week' \| 'datetimerange' \| 'daterange' \| 'monthrange' \| 'yearrange'` | date | | format | format of the displayed value in the input box | ^[string] see [date formats](#date-formats) | YYYY-MM-DD | | popper-class | custom class name for DatePicker's dropdown | ^[string] | — | | popper-style | custom style for DatePicker's dropdown | ^[string] / ^[object] | — | | popper-options | Customized popper option see more at [popper.js](https://popper.js.org/docs/v2/) | ^[object]`Partial` | {} | | range-separator | range separator | ^[string] | '-' | | default-value | optional, default date of the calendar | ^[object]`Date \| [Date, Date]` | — | | default-time | optional, the time value to use when selecting date range | ^[object]`Date \| [Date, Date]` | — | | value-format | optional, format of binding value. If not specified, the binding value will be a Date object | ^[string] see [date formats](#date-formats) | — | | id | same as `id` in native input | ^[string] / ^[array]`[string, string]` | — | | name | same as `name` in native input | ^[string] / ^[array]`[string, string]` | '' | | unlink-panels | unlink two date-panels in range-picker | ^[boolean] | false | | prefix-icon | custom prefix icon component. By default, if the value of `type` is `TimeLikeType`, the value is `Clock`, else is `Calendar` | ^[string] / ^[object]`Component` | '' | | clear-icon | custom clear icon component | ^[string] / ^[object]`Component` | `CircleClose` | | validate-event | whether to trigger form validation | ^[boolean] | true | | disabled-date | a function determining if a date is disabled with that date as its parameter. Should return a Boolean | ^[Function]`(data: Date) => boolean` | — | | shortcuts | an object array to set shortcut options | ^[array]`Array<{ text: string, value: Date \| Function }>` | [] | | cell-class-name | set custom className | ^[Function]`(data: Date) => string` | — | | teleported | whether date-picker dropdown is teleported to the body | ^[boolean] | true | | empty-values ^(2.7.0) | empty values of component, [see config-provider](./config-provider.md#empty-values-configurations) | ^[array] | — | | value-on-clear ^(2.7.0) | clear return value, [see config-provider](./config-provider.md#empty-values-configurations) | ^[string] / ^[number] / ^[boolean] / ^[Function] | — | | fallback-placements ^(2.8.4) | list of possible positions for Tooltip [popper.js](https://popper.js.org/docs/v2/modifiers/flip/#fallbackplacements) | ^[array]`Placement[]` | ['bottom', 'top', 'right', 'left'] | | placement ^(2.8.4) | position of dropdown | `Placement` | bottom | | show-footer ^(2.10.5) | whether to show footer | ^[boolean] | true | | show-confirm ^(2.11.0) | whether to show the confirm button | ^[boolean] | true | | show-week-number ^(2.10.3) | show the week number besides the week | ^[boolean] | false | | automatic-dropdown ^(2.11.4) | this prop decides if the date picker panel pops up when the input is focused. (The default value will be set to false in version 3.0) | ^[boolean] | true | ### Events | Name | Description | Type | | --------------- | --------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | change | triggers when user confirms the value or click outside | ^[Function]`(val: typeof v-model) => void` | | blur | triggers when Input blurs | ^[Function]`(e: FocusEvent) => void` | | focus | triggers when Input focuses | ^[Function]`(e: FocusEvent) => void` | | clear ^(2.7.7) | triggers when a clear button is clicked | ^[Function]`() => void` | | calendar-change | triggers when the calendar selected date is changed. Only for `range` | ^[Function]`(val: [Date, null \| Date]) => void` | | panel-change | triggers when the navigation button click. | ^[Function]`(date: Date \| [Date, Date], mode: 'month' \| 'year', view?: string) => void` | | visible-change | triggers when the DatePicker's dropdown appears/disappears | ^[Function]`(visibility: boolean) => void` | ### Slots | Name | Description | | ------------------- | ------------------------------ | | default | custom cell content | | range-separator | custom range separator content | | prev-month ^(2.8.0) | prev month icon | | next-month ^(2.8.0) | next month icon | | prev-year ^(2.8.0) | prev year icon | | next-year ^(2.8.0) | next year icon | ### Exposes | Name | Description | Type | | --------------------- | ------------------------------ | ----------------------- | | focus | focus the DatePicker component | ^[Function]`() => void` | | blur ^(2.8.7) | blur the DatePicker component | ^[Function]`() => void` | | handleOpen ^(2.2.16) | open the DatePicker popper | ^[Function]`() => void` | | handleClose ^(2.2.16) | close the DatePicker popper | ^[Function]`() => void` | ## Type Declarations
Show declarations ```ts import type { Options as PopperOptions } from '@popperjs/core' type TimeLikeType = 'datetime' | 'datetimerange' type Placement = | 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end' | 'right' | 'right-start' | 'right-end' ```
## Vue Examples ### custom-content.vue ```vue ``` ### custom-icon.vue ```vue ``` ### custom-prefix-icon.vue ```vue ``` ### date-formats.vue ```vue ``` ### date-range.vue ```vue ``` ### default-time.vue ```vue ``` ### default-value.vue ```vue ``` ### enter-date.vue ```vue ``` ### month-range.vue ```vue ``` ### other-measurements.vue ```vue ``` ### year-range.vue ```vue ``` --- Title: DateTimePicker URL: https://element-plus.org/en-US/component/datetime-picker --- # DateTimePicker Select date and time in one picker. ## Date and time ## DateTime Formats Use `format` to control displayed text's format in the input box. Use `value-format` to control binding value's format. By default, the component accepts and emits a `Date` object. Check the list [here](https://day.js.org/docs/en/display/format#list-of-all-available-formats) of all available formats of Day.js. ## Date and time formats in dropdown panel Use `date-format` and `time-format` to control displayed text's format in the dropdown panel's input box. ## Date and time range ## Default time value for start date and end date ## Custom icon ^(2.8.0) Custom icons available with slots. ## API ### Attributes | Name | Description | Type | Default | | ---------------------------- | -------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------- | | model-value / v-model | binding value, if it is an `range` picker, the length of the array should be 2 | ^[number] / ^[string] / ^[Date] / ^[array]`number[] \| string[] \| Date[]` | '' | | readonly | whether DatePicker is read only | ^[boolean] | false | | disabled | whether DatePicker is disabled | ^[boolean] | false | | editable | whether the input is editable | ^[boolean] | true | | clearable | whether to show clear button | ^[boolean] | true | | size | size of Input | ^[enum]`'large' \| 'default' \| 'small'` | default | | placeholder | placeholder in non-range mode | ^[string] | — | | start-placeholder | placeholder for the start date in range mode | ^[string] | — | | end-placeholder | placeholder for the end date in range mode | ^[string] | — | | arrow-control | whether to pick time using arrow buttons | ^[boolean] | false | | type | type of the picker | ^[enum]`'year' \| 'month' \| 'date' \| 'datetime' \| 'week' \| 'datetimerange' \| 'daterange'` | date | | format | format of the displayed value in the input box | ^[string] see [date formats](./date-picker.md#date-formats) | YYYY-MM-DD HH:mm:ss | | popper-class | custom class name for DateTimePicker's dropdown | ^[string] | — | | popper-style | custom style for DateTimePicker's dropdown | ^[string] / ^[object] | — | | popper-options | Customized popper option see more at [popper.js](https://popper.js.org/docs/v2/) | ^[object]`Partial` | {} | | fallback-placements ^(2.8.4) | list of possible positions for Tooltip [popper.js](https://popper.js.org/docs/v2/modifiers/flip/#fallbackplacements) | ^[array]`Placement[]` | ['bottom', 'top', 'right', 'left'] | | placement ^(2.8.4) | position of dropdown | `Placement` | bottom | | range-separator | range separator | ^[string] | '-' | | default-value | optional, default date of the calendar | ^[object]`Date \| [Date, Date]` | — | | default-time | the default time value after picking a date. Time `00:00:00` will be used if not specified | ^[object]`Date \| [Date, Date]` | — | | value-format | optional, format of binding value. If not specified, the binding value will be a Date object | ^[string] see [date formats](https://day.js.org/docs/en/display/format) | — | | date-format ^(2.4.0) | optional, format of the date displayed in input's inner panel | ^[string] see [date formats](https://day.js.org/docs/en/display/format) | YYYY-MM-DD | | time-format ^(2.4.0) | optional, format of the time displayed in input's inner panel | ^[string] see [date formats](https://day.js.org/docs/en/display/format) | HH:mm:ss | | id | same as `id` in native input | ^[string] / ^[array]`[string, string]` | — | | name | same as `name` in native input | ^[string] | — | | unlink-panels | unlink two date-panels in range-picker | ^[boolean] | false | | prefix-icon | Custom prefix icon component | ^[string] / `Component` | Date | | clear-icon | Custom clear icon component | ^[string] / `Component` | CircleClose | | shortcuts | an object array to set shortcut options | ^[array]`Array<{ text: string, value: Date \| Function }>` | — | | disabled-date | a function determining if a date is disabled with that date as its parameter. Should return a Boolean | ^[Function]`(data: Date) => boolean` | — | | disabled-hours | To specify the array of hours that cannot be selected | ^[Function]`(role: string, comparingDate?: Dayjs) => number[]` | — | | disabled-minutes | To specify the array of minutes that cannot be selected | ^[Function]`(hour: number, role: string, comparingDate?: Dayjs) => number[]` | — | | disabled-seconds | To specify the array of seconds that cannot be selected | ^[Function]`(hour: number, minute: number, role: string, comparingDate?: Dayjs) => number[]` | — | | cell-class-name | set custom className | ^[Function]`(data: Date) => string` | — | | teleported | whether datetime-picker dropdown is teleported to the body | ^[boolean] | true | | empty-values ^(2.7.0) | empty values of component, [see config-provider](./config-provider.md#empty-values-configurations) | ^[array] | — | | value-on-clear ^(2.7.0) | clear return value, [see config-provider](./config-provider.md#empty-values-configurations) | ^[string] / ^[number] / ^[boolean] / ^[Function] | — | | show-now ^(2.8.7) | whether to show the now button | ^[boolean] | true | | show-footer ^(2.10.5) | whether to show footer where the date picker is one ^[enum]`'datetime' \| 'datetimerange'` | ^[boolean] | true | | show-confirm ^(2.11.0) | whether to show the confirm button | ^[boolean] | true | | show-week-number ^(2.10.3) | show the week number besides the week | `boolean` | false | ### Events | Name | Description | Parameters | | --------------- | --------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | change | triggers when user confirms the value or click outside | ^[Function]`(val: typeof v-model) => void` | | blur | triggers when Input blurs | ^[Function]`(e: FocusEvent) => void` | | focus | triggers when Input focuses | ^[Function]`(e: FocusEvent) => void` | | clear ^(2.7.7) | triggers when a clear button is clicked | ^[Function]`() => void` | | calendar-change | triggers when the calendar selected date is changed. Only for `range` | ^[Function]`(val: [Date, null \| Date]) => void` | | panel-change | triggers when the navigation button click. | ^[Function]`(date: Date \| [Date, Date], mode: 'month' \| 'year', view?: string) => void` | | visible-change | triggers when the DateTimePicker's dropdown appears/disappears | ^[Function]`(visibility: boolean) => void` | ### Slots | Name | Description | | ------------------- | ------------------------------ | | default | custom cell content | | range-separator | custom range separator content | | prev-month ^(2.8.0) | prev month icon | | next-month ^(2.8.0) | next month icon | | prev-year ^(2.8.0) | prev year icon | | next-year ^(2.8.0) | next year icon | ### Exposes | Method | Description | Type | | ------------- | ------------------------------ | ----------------------- | | focus | focus the DatePicker component | ^[Function]`() => void` | | blur ^(2.8.7) | blur the DatePicker component | ^[Function]`() => void` | ## Type Declarations
Show declarations ```ts type Placement = | 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end' | 'right' | 'right-start' | 'right-end' ```
## Vue Examples ### custom-icon.vue ```vue ``` ### date-and-time-formats-panel.vue ```vue ``` ### date-and-time-formats.vue ```vue ``` ### date-and-time-range.vue ```vue ``` ### date-and-time.vue ```vue ``` ### default-time.vue ```vue ``` --- Title: Descriptions URL: https://element-plus.org/en-US/component/descriptions --- # Descriptions Display multiple fields in list form. ## Basic usage ## Sizes ## Vertical List ## Rowspan ^(2.8.1) ## Customized Style ## Descriptions API ### Descriptions Attributes | Name | Description | Type | Default | | -------------------- | ------------------------------------------ | ---------------------------------------------- | ---------- | | border | with or without border | ^[boolean] | false | | column | numbers of `Descriptions Item` in one line | ^[number] | 3 | | direction | direction of list | ^[enum]`'vertical' \| 'horizontal'` | horizontal | | size | size of list | ^[enum]`'' \| 'large' \| 'default' \| 'small'` | — | | title | title text, display on the top left | ^[string] | '' | | extra | extra text, display on the top right | ^[string] | '' | | label-width ^(2.8.8) | label width of every column | ^[string] / ^[number] | — | ### Descriptions Slots | Name | Description | Subtags | | ------- | ------------------------------------------- | ----------------- | | default | customize default content | Descriptions Item | | title | custom title, display on the top left | — | | extra | custom extra area, display on the top right | — | ## DescriptionsItem API ### DescriptionsItem Attributes | Name | Description | Type | Default | | -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------- | ------- | | label | label text | ^[string] | '' | | span | colspan of column | ^[number] | 1 | | rowspan ^(2.8.1) | the number of rows a cell should span | ^[number] | 1 | | width | column width, the width of the same column in different rows is set by the max value (If no `border`, width contains label and content) | ^[string] / ^[number] | '' | | min-width | column minimum width, columns with `width` has a fixed width, while columns with `min-width` has a width that is distributed in proportion (If no`border`, width contains label and content) | ^[string] / ^[number] | '' | | label-width ^(2.8.8) | column label width, if not set, it will be the same as the width of the column. Higher priority than the `label-width` of `Descriptions` | ^[string] / ^[number] | — | | align | column content alignment (If no `border`, effective for both label and content) | ^[enum]`'left' \| 'center' \| 'right'` | left | | label-align | column label alignment, if omitted, the value of the above `align` attribute will be applied (If no `border`, please use `align` attribute) | ^[enum]`'left' \| 'center' \| 'right'` | — | | class-name | column content custom class name | ^[string] | '' | | label-class-name | column label custom class name | ^[string] | '' | ### DescriptionsItem Slots | Name | Description | | ------- | ------------------------- | | default | customize default content | | label | custom label | ## Vue Examples ### basic-usage.vue ```vue ``` ### customized-style.vue ```vue ``` ### rowspan.vue ```vue ``` ### sizes.vue ```vue ``` ### vertical-list.vue ```vue ``` --- Title: Dialog URL: https://element-plus.org/en-US/component/dialog --- # Dialog Informs users while preserving the current page state. ## Basic usage Dialog pops up a dialog box, and it's quite customizable. ## Customized Content The content of Dialog can be anything, even a table or a form. This example shows how to use Element Plus Table and Form with Dialog. ## Customized Header The `header` slot can be used to customize the area where the title is displayed. In order to maintain accessibility, use the `title` attribute in addition to using this slot, or use the `titleId` slot property to specify which element should be read out as the dialog title. ## Nested Dialog If a Dialog is nested in another Dialog, `append-to-body` is required. ## Centered content Dialog's content can be centered. ## Align Center dialog Open dialog from the center of the screen. ## Destroy on Close When this is feature is enabled, the content under default slot will be destroyed with a `v-if` directive. Enable this when you have perf concerns. ## Draggable Dialog Try to drag the `header` part. ## Fullscreen Set the `fullscreen` attribute to open fullscreen dialog. ## Modal Setting `modal` to `false` will hide modal (overlay) of dialog. Starting from version ^(2.10.5), `modal-penetrable` attribute is added, which can be penetrable. ## Custom Animation ^(2.10.5) Customize dialog animation through the `transition` attribute, which accepts either: - ​Transition name​​ (string) - ​​Vue transition configuration​​ (object) ## Events Open developer console (ctrl + shift + J), to see order of events. ## API ### Attributes | Name | Description | Type | Default | | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------- | ----------- | | model-value / v-model | visibility of Dialog | ^[boolean] | false | | title | title of Dialog. Can also be passed with a named slot (see the following table) | ^[string] | '' | | width | width of Dialog, default is 50% | ^[string] / ^[number] | '' | | fullscreen | whether the Dialog takes up full screen | ^[boolean] | false | | top | value for `margin-top` of Dialog CSS, default is 15vh | ^[string] | '' | | modal | whether a mask is displayed | ^[boolean] | true | | modal-penetrable ^(2.10.5) | whether the mask is penetrable. The modal attribute must be `false`. | ^[boolean] | false | | modal-class | custom class names for mask | ^[string] | — | | header-class ^(2.9.3) | custom class names for header wrapper | ^[string] | — | | body-class ^(2.9.3) | custom class names for body wrapper | ^[string] | — | | footer-class ^(2.9.3) | custom class names for footer wrapper | ^[string] | — | | append-to-body | whether to append Dialog itself to body. A nested Dialog should have this attribute set to `true` | ^[boolean] | false | | append-to ^(2.4.3) | which element the Dialog appends to. Will override `append-to-body` | ^[CSSSelector] / ^[HTMLElement] | body | | lock-scroll | whether scroll of body is disabled while Dialog is displayed | ^[boolean] | true | | open-delay | the Time(milliseconds) before open | ^[number] | 0 | | close-delay | the Time(milliseconds) before close | ^[number] | 0 | | close-on-click-modal | whether the Dialog can be closed by clicking the mask | ^[boolean] | true | | close-on-press-escape | whether the Dialog can be closed by pressing ESC | ^[boolean] | true | | show-close | whether to show a close button | ^[boolean] | true | | before-close | callback before Dialog closes, and it will prevent Dialog from closing, use done to close the dialog | ^[Function]`(done: DoneFn) => void` | — | | draggable | enable dragging feature for Dialog | ^[boolean] | false | | overflow ^(2.5.4) | draggable Dialog can overflow the viewport | ^[boolean] | false | | center | whether to align the header and footer in center | ^[boolean] | false | | align-center ^(2.2.16) | whether to align the dialog both horizontally and vertically | ^[boolean] | false | | destroy-on-close | destroy elements in Dialog when closed | ^[boolean] | false | | close-icon | custom close icon, default is Close | ^[string] / ^[Component] | — | | z-index | same as z-index in native CSS, z-order of dialog | ^[number] | — | | header-aria-level ^(a11y) | header's `aria-level` attribute | ^[string] | 2 | | transition ^(2.10.5) | custom transition configuration for dialog animation. Can be a string (transition name) or an object with Vue transition props | ^[string] / ^[object]`TransitionProps` | dialog-fade | | custom-class ^(deprecated) | custom class names for Dialog | ^[string] | '' | ### Slots | Name | Description | | ------------------- | ----------------------------------------------------------------------------------------------------- | | default | default content of Dialog | | header | content of the Dialog header; Replacing this removes the title, but does not remove the close button. | | footer | content of the Dialog footer | | title ^(deprecated) | works the same as the header slot. Use that instead. | ### Events | Name | Description | Type | | ---------------- | ------------------------------------------------ | ----------------------- | | open | triggers when the Dialog opens | ^[Function]`() => void` | | opened | triggers when the Dialog opening animation ends | ^[Function]`() => void` | | close | triggers when the Dialog closes | ^[Function]`() => void` | | closed | triggers when the Dialog closing animation ends | ^[Function]`() => void` | | open-auto-focus | triggers after Dialog opens and content focused | ^[Function]`() => void` | | close-auto-focus | triggers after Dialog closed and content focused | ^[Function]`() => void` | ### Exposes | Name | Description | Type | | ---------------------- | -------------- | ----------------------- | | resetPosition ^(2.8.1) | reset position | ^[Function]`() => void` | | handleClose ^(2.9.8) | close dialog | ^[Function]`() => void` | ## FAQ #### Using dialog in SFC, the scope style does not take effect Typical issue: [#10515](https://github.com/element-plus/element-plus/issues/10515) PS: Since the dialog is rendered using `Teleport`, the style of the root node is recommended to be written globally. #### When the dialog is displayed and hidden, there is a situation where the page elements are displaced back and forth Typical issue: [#10481](https://github.com/element-plus/element-plus/issues/10481) PS: It is recommended to place the scroll area inside a vue mounted node, e.g. `
`, and use the `overflow: hidden` style for the body. ## Vue Examples ### align-center.vue ```vue ``` ### basic-usage.vue ```vue ``` ### centered-content.vue ```vue ``` ### custom-animation.vue ```vue ``` ### customization-content.vue ```vue ``` ### customization-header.vue ```vue ``` ### destroy-on-close.vue ```vue ``` ### draggable-dialog.vue ```vue ``` ### events.vue ```vue ``` ### fullscreen.vue ```vue ``` ### modal.vue ```vue ``` ### nested-dialog.vue ```vue ``` --- Title: Divider URL: https://element-plus.org/en-US/component/divider --- # Divider The dividing line that separates the content. ## Basic usage Divide the text of different paragraphs. ## Custom content You can customize the content on the divider line. ## dashed line You can set the style of divider. ## Vertical divider ## API ### Attributes | Name | Description | Type | Default | | ---------------- | ---------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | ---------- | | direction | Set divider's direction | ^[enum]`'horizontal' \| 'vertical'` | horizontal | | border-style | Set the style of divider | ^[enum]`'none' \| 'solid' \| 'hidden' \| 'dashed' \| ...` [css/border-style](https://developer.mozilla.org/zh-CN/docs/Web/CSS/border-style) | solid | | content-position | The position of the customized content on the divider line | ^[enum]`'left' \| 'right' \| 'center'` | center | ### Slots | Name | Description | | ------- | -------------------------------------- | | default | Customized content on the divider line | ## Vue Examples ### basic-usage.vue ```vue ``` ### custom-content.vue ```vue ``` ### line-dashed.vue ```vue ``` ### vertical-divider.vue ```vue ``` --- Title: Drawer URL: https://element-plus.org/en-US/component/drawer --- # Drawer Sometimes, `Dialog` does not always satisfy our requirements, let's say you have a massive form, or you need space to display something like `terms & conditions`, `Drawer` has almost identical API with `Dialog`, but it introduces different user experience. ## Basic Usage Callout a temporary drawer, from multiple direction ## No Title When you no longer need a title, you can remove it from the drawer. ## Customized Content Like `Dialog`, `Drawer` can be used to display a multitude of diverse interactions. ## Customized Header The `header` slot can be used to customize the area where the title is displayed. In order to maintain accessibility, use the `title` attribute in addition to using this slot, or use the `titleId` slot property to specify which element should be read out as the drawer title. ## Resizable Drawer ^(2.11.0) Try to drag the edge part. ## Nested Drawer You can also have multiple layer of `Drawer` just like `Dialog`. ## Modal Setting `modal` to `false` will hide modal (overlay) of drawer. Starting from version ^(2.11.7), `modal-penetrable` attribute is added, which can be penetrable. ## API ### Attributes | Name | Description | Type | Default | | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | | model-value / v-model | Should Drawer be displayed | ^[boolean] | false | | append-to-body | Controls should Drawer be inserted to DocumentBody Element, nested Drawer must assign this param to **true** | ^[boolean] | false | | append-to ^(2.8.0) | which element the Drawer appends to. Will override `append-to-body` | ^[CSSSelector] / ^[HTMLElement] | body | | lock-scroll | whether scroll of body is disabled while Drawer is displayed | ^[boolean] | true | | before-close | If set, closing procedure will be halted | ^[Function]`(done: (cancel?: boolean) => void) => void(done is function type that accepts a boolean as parameter, calling done with true or without parameter will abort the close procedure)` | — | | close-on-click-modal | whether the Drawer can be closed by clicking the mask | ^[boolean] | true | | close-on-press-escape | Indicates whether Drawer can be closed by pressing ESC | ^[boolean] | true | | open-delay | Time(milliseconds) before open | ^[number] | 0 | | close-delay | Time(milliseconds) before close | ^[number] | 0 | | destroy-on-close | Indicates whether children should be destroyed after Drawer closed | ^[boolean] | false | | modal | Should show shadowing layer | ^[boolean] | true | | modal-penetrable ^(2.11.7) | whether the mask is penetrable. The modal attribute must be `false`. | ^[boolean] | false | | direction | Drawer's opening direction | ^[enum]`'rtl' \| 'ltr' \| 'ttb' \| 'btt'` | rtl | | resizable ^(2.11.0) | enable resizable feature for Drawer | ^[boolean] | false | | show-close | Should show close button at the top right of Drawer | ^[boolean] | true | | size | Drawer's size, if Drawer is horizontal mode, it effects the width property, otherwise it effects the height property, when size is `number` type, it describes the size by unit of pixels; when size is `string` type, it should be used with `x%` notation, other wise it will be interpreted to pixel unit | ^[number] / ^[string] | 30% | | title | Drawer's title, can also be set by named slot, detailed descriptions can be found in the slot form | ^[string] | — | | with-header | Flag that controls the header section's existence, default to true, when withHeader set to false, both `title attribute` and `title slot` won't work | ^[boolean] | true | | modal-class | Extra class names for shadowing layer | ^[string] | — | | header-class ^(2.9.3) | custom class names for header wrapper | ^[string] | — | | body-class ^(2.9.3) | custom class names for body wrapper | ^[string] | — | | footer-class ^(2.9.3) | custom class names for footer wrapper | ^[string] | — | | z-index | set z-index | ^[number] | — | | header-aria-level ^(a11y) | header's `aria-level` attribute | ^[string] | 2 | | custom-class ^(deprecated) | Extra class names for Drawer | ^[string] | — | ### Events | Name | Description | Type | | ---------------------- | ------------------------------------------------------------ | ---------------------------------------------------- | | open | Triggered before Drawer opening animation begins | ^[Function]`() => void` | | opened | Triggered after Drawer opening animation ended | ^[Function]`() => void` | | close | Triggered before Drawer closing animation begins | ^[Function]`() => void` | | closed | Triggered after Drawer closing animation ended | ^[Function]`() => void` | | open-auto-focus | triggers after Drawer opens and content focused | ^[Function]`() => void` | | close-auto-focus | triggers after Drawer closed and content focused | ^[Function]`() => void` | | resize-start ^(2.11.8) | Triggered when resizing starts (when `resizable` is enabled) | ^[Function]`(evt: MouseEvent, size: number) => void` | | resize ^(2.11.8) | Triggered while resizing (when `resizable` is enabled) | ^[Function]`(evt: MouseEvent, size: number) => void` | | resize-end ^(2.11.8) | Triggered when resizing ends (when `resizable` is enabled) | ^[Function]`(evt: MouseEvent, size: number) => void` | ### Slots | Name | Description | | ------------------- | ---------------------------------------------------------------------------------------------- | | default | Drawer's Content | | header | Drawer header section; Replacing this removes the title, but does not remove the close button. | | footer | Drawer footer Section | | title ^(deprecated) | Works the same as the header slot. Use that instead. | ### Exposes | Name | Description | | ----------- | --------------------------------------------------------------- | | handleClose | In order to close Drawer, this method will call `before-close`. | ## Vue Examples ### basic-usage.vue ```vue ``` ### customization-content.vue ```vue ``` ### customization-header.vue ```vue ``` ### modal.vue ```vue ``` ### nested-drawer.vue ```vue ``` ### no-title.vue ```vue ``` ### resizable.vue ```vue ``` --- Title: Dropdown URL: https://element-plus.org/en-US/component/dropdown --- # Dropdown Toggleable menu for displaying lists of links and actions. ## Basic usage Hover on the dropdown menu to unfold it for more actions. ## Placement Support 6 placements. ## Triggering element Use the button to trigger the dropdown list. ## How to trigger Click the triggering element or hover on it. ## Menu hiding behavior Use `hide-on-click` to define if menu closes on clicking. ## Command event Clicking each dropdown item fires an event whose parameter is assigned by each item. ## Dropdown methods You can open or close the dropdown menu by manually use `handleOpen` or `handleClose` ## Sizes Besides default size, Dropdown component provides three additional sizes for you to choose among different scenarios. ## Virtual triggering ^(2.11.3) Sometimes we want to render the dropdown on some other trigger element, we can separate the trigger and the content. ## Dropdown API ### Dropdown Attributes | Name | Description | Type | Default | | ---------------------------- | --------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------- | | type | menu button type, refer to `Button` Component, only works when `split-button` is true | ^[enum]`'' \| 'default' \| 'primary' \| 'success' \| 'warning' \| 'info' \| 'danger' \| 'text' (deprecated)` | '' | | size | menu size, also works on the split button | ^[enum]`'' \| 'large' \| 'default' \| 'small'` | '' | | button-props | props for the button component, refer to [Button Attributes](./button.html#button-attributes) | ^[object] | — | | max-height | the max height of menu | ^[string] / ^[number] | '' | | split-button | whether a button group is displayed | ^[boolean] | false | | disabled | whether to disable | ^[boolean] | false | | placement | placement of pop menu | ^[enum]`'top' \| 'top-start' \| 'top-end' \| 'bottom' \| 'bottom-start' \| 'bottom-end'` | bottom | | effect | Tooltip theme, built-in theme: `dark` / `light` | ^[enum]`'dark' \| 'light'` / ^[string] | light | | trigger | how to trigger | ^[enum]`'click' \| 'hover' \| 'contextmenu'` / ^[array]`Array<'click' \| 'hover' \| 'contextmenu'>` | hover | | trigger-keys ^(2.9.1) | specify which keys on the keyboard can trigger when pressed | ^[array]`string[]` | `['Enter', 'Space', 'ArrowDown', 'NumpadEnter']` | | virtual-triggering ^(2.11.3) | indicates whether virtual triggering is enabled | ^[boolean] | — | | virtual-ref ^(2.11.3) | indicates the reference element to which the dropdown is attached | ^[HTMLElement] | — | | hide-on-click | whether to hide menu after clicking menu-item | ^[boolean] | true | | show-arrow ^(2.11.3) | whether the tooltip content has an arrow | ^[boolean] | true | | show-timeout | delay time before show a dropdown (only works when trigger is `hover`) | ^[number] | 150 | | hide-timeout | delay time before hide a dropdown (only works when trigger is `hover`) | ^[number] | 150 | | role | the ARIA role attribute for the dropdown menu. Depending on the use case, you may want to change this to 'navigation' | ^[enum]`'dialog' \| 'grid' \| 'group' \| 'listbox' \| 'menu' \| 'navigation' \| 'tooltip' \| 'tree'` | menu | | tabindex | [tabindex](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of Dropdown | ^[number] / ^[string] | 0 | | popper-class | custom class name for Dropdown's dropdown | ^[string] / ^[object] | '' | | popper-style ^(2.11.5) | custom style for Dropdown's dropdown | ^[string] / ^[object] | — | | popper-options | [popper.js](https://popper.js.org/docs/v2/) parameters | ^[object] | `{modifiers: [{name: 'computeStyles',options: {gpuAcceleration: false}}]}` | | teleported ^(2.2.20) | whether the dropdown popup is teleported to the body | ^[boolean] | true | | append-to ^(2.13.0) | which element the dropdown CONTENT appends to | ^[CSSSelector] / ^[HTMLElement] | — | | persistent ^(2.9.5) | when dropdown inactive and `persistent` is `false` , dropdown menu will be destroyed | ^[boolean] | true | ### Dropdown Slots | Name | Description | Subtags | | -------- | --------------------------------------------------------------------------------------------------------------------------------------------- | ------------- | | default | content of Dropdown. Notice: Must be a valid html dom element (ex. `,