### Element UI Select Component Examples (HTML/Vue)
Source: https://context7.com/yidianhengji/pit-element-ui-doc/llms.txt
Demonstrates various configurations of the Element UI Select component, including basic usage, clearable functionality, multiple selections, collapsed tags, filtering, remote search, and option grouping. This snippet requires Vue.js and Element UI to be installed.
```html
```
--------------------------------
### Install and Configure babel-plugin-component for On-Demand Import (Bash/JSON)
Source: https://github.com/yidianhengji/pit-element-ui-doc/blob/main/docs/en-US/quickstart.md
These snippets show the process of installing the babel-plugin-component and configuring it in a .babelrc file to enable on-demand importing of Element UI components. This method helps reduce the final bundle size by only including the components used in the project. The installation is done via npm, and the configuration is in JSON format.
```bash
npm install babel-plugin-component -D
```
```json
{
"presets": [["es2015", { "modules": false }]],
"plugins": [
[
"component",
{
"libraryName": "element-ui",
"styleLibraryName": "theme-chalk"
}
]
]
}
```
--------------------------------
### Install Element UI Theme CLI Tool
Source: https://github.com/yidianhengji/pit-element-ui-doc/blob/main/docs/en-US/custom-theme.md
Instructions for installing the `element-theme` CLI tool, which is useful for projects not using SCSS. It can be installed globally or locally, with local installation recommended for better project management. After installation, the `et` command becomes available.
```shell
npm i element-theme -g
# Install chalk theme from npm or GitHub
npm i element-theme-chalk -D
# or
npm i https://github.com/ElementUI/theme-chalk -D
```
--------------------------------
### Install and Configure Element UI (JavaScript)
Source: https://context7.com/yidianhengji/pit-element-ui-doc/llms.txt
Installs Element UI via npm and configures it globally in a Vue application. It demonstrates both full import and global settings for component size and z-index.
```javascript
// Install via npm
// npm i pit-element-ui -S
// main.js - Full Import
import Vue from 'vue';
import ElementUI from 'pit-element-ui';
import 'pit-element-ui/lib/theme-chalk/index.css';
import App from './App.vue';
// Global config: set default size and z-index for modals
Vue.use(ElementUI, { size: 'small', zIndex: 3000 });
new Vue({
el: '#app',
render: h => h(App)
});
```
--------------------------------
### MessageBox Centered Content Example
Source: https://github.com/yidianhengji/pit-element-ui-doc/blob/main/docs/en-US/message-box.md
An example demonstrating how to center the content within a MessageBox by setting the `center` option to `true`.
```APIDOC
## Centered Content
Content of MessageBox can be centered.
:::demo Setting `center` to `true` will center the content
```html
Click to open Message Box
```
:::
```
--------------------------------
### Centered Content Example
Source: https://github.com/yidianhengji/pit-element-ui-doc/blob/main/docs/en-US/dialog.md
Demonstrates how to center the header and footer of a dialog using the `center` prop.
```APIDOC
## Centered Content
### Description
Dialog's content can be centered. Setting `center` to `true` will center dialog's header and footer horizontally. `center` only affects Dialog's header and footer. The body of Dialog can be anything, so sometimes it may not look good when centered. You need to write some CSS if you wish to center the body as well.
### Method
N/A (Component Usage)
### Endpoint
N/A (Component Usage)
### Parameters
#### Path Parameters
N/A
#### Query Parameters
N/A
#### Request Body
N/A
### Request Example
```html
Click to open the Dialog
It should be noted that the content will not be aligned in center by default
```
### Response
#### Success Response (200)
N/A (Component Usage)
#### Response Example
N/A (Component Usage)
```
--------------------------------
### DatePicker with Shortcuts
Source: https://github.com/yidianhengji/pit-element-ui-doc/blob/main/docs/en-US/date-picker.md
Shows how to configure shortcuts for the Element UI DatePicker, allowing users to quickly select predefined date ranges. This example includes shortcuts for 'today' and 'yesterday'.
```html
```
--------------------------------
### Nested Dialog Example
Source: https://github.com/yidianhengji/pit-element-ui-doc/blob/main/docs/en-US/dialog.md
Demonstrates how to use nested dialogs by setting `append-to-body` to true on the inner dialog.
```APIDOC
## Nested Dialog
### Description
If a Dialog is nested in another Dialog, `append-to-body` is required. Normally we do not recommend using nested Dialog. If you need multiple Dialogs rendered on the page, you can simply flat them so that they're siblings to each other. If you must nest a Dialog inside another Dialog, set `append-to-body` of the nested Dialog to true, and it will append to body instead of its parent node, so both Dialogs can be correctly rendered.
### Method
N/A (Component Usage)
### Endpoint
N/A (Component Usage)
### Parameters
#### Path Parameters
N/A
#### Query Parameters
N/A
#### Request Body
N/A
### Request Example
```html
open the outer Dialog
```
### Response
#### Success Response (200)
N/A (Component Usage)
#### Response Example
N/A (Component Usage)
```
--------------------------------
### Basic Tabs Usage with Vue
Source: https://github.com/yidianhengji/pit-element-ui-doc/blob/main/docs/en-US/tabs.md
Demonstrates the basic usage of Element UI Tabs, including how to set the active tab and handle tab clicks. It requires Vue.js and Element UI to be installed.
```html
User
Config
Role
Task
```
--------------------------------
### Basic ColorPicker Usage (Vue)
Source: https://github.com/yidianhengji/pit-element-ui-doc/blob/main/docs/en-US/color-picker.md
Demonstrates the basic setup of the ColorPicker component, binding a string variable to v-model. It shows how to initialize with a default color or with no default value.
```html
With default value
With no default value
```
--------------------------------
### Fully Import Element UI in main.js (JavaScript)
Source: https://github.com/yidianhengji/pit-element-ui-doc/blob/main/docs/en-US/quickstart.md
This snippet demonstrates how to import the entire Element UI library and its CSS into a Vue application's main JavaScript file. It's suitable for projects where bundle size is not a primary concern or for initial setup. Ensure 'pit-element-ui' is installed.
```javascript
import Vue from 'vue';
import ElementUI from 'pit-element-ui';
import 'pit-element-ui/lib/theme-chalk/index.css';
import App from './App.vue';
Vue.use(ElementUI);
new Vue({
el: '#app',
render: h => h(App)
});
```
--------------------------------
### Steps with Description
Source: https://github.com/yidianhengji/pit-element-ui-doc/blob/main/docs/en-US/steps.md
Demonstrates how to add descriptions to each step.
```APIDOC
## Step Bar with Description
### Description
There is a description for each step. This is achieved by providing the `description` attribute to the `el-step` component.
### Method
N/A (Component Usage)
### Endpoint
N/A (Component Usage)
### Parameters
#### Component Attributes (el-steps)
- **active** (number) - Required - The index of the current active step, starting from 0.
#### Component Attributes (el-step)
- **title** (string) - Required - The title of the step.
- **description** (string) - Optional - The description for the step.
### Request Example
```html
```
### Response
#### Success Response (N/A - Component Rendering)
N/A
#### Response Example
N/A
```
--------------------------------
### Import Element UI with vue-i18n via CDN
Source: https://github.com/yidianhengji/pit-element-ui-doc/blob/main/docs/en-US/i18n.md
This example demonstrates importing Vue, vue-i18n, Element UI, and multiple Element UI locales (Chinese and English) via CDN. It then configures vue-i18n to use these Element UI locales. This setup is suitable for projects requiring internationalization managed by vue-i18n.
```html
```
--------------------------------
### Element UI Input Component Examples
Source: https://context7.com/yidianhengji/pit-element-ui-doc/llms.txt
Demonstrates various configurations of the Element UI Input component, including basic input, clearable input, password input, disabled input, inputs with prefix and suffix icons, textareas, auto-sizing textareas, inputs with character limits, inputs with prepend and append slots, and autocomplete functionality. Requires Element UI framework.
```html
https://
.com
```
--------------------------------
### Customizing Collapse Panel Titles with Slots (HTML)
Source: https://github.com/yidianhengji/pit-element-ui-doc/blob/main/docs/en-US/collapse.md
Demonstrates how to customize the title of an El-Collapse-Item using the 'title' slot. This allows for the inclusion of custom HTML content, like icons, within the panel's header. The example shows a basic accordion setup with one item using a slot for its title.
```html
Consistency
Consistent with real life: in line with the process and logic of real life, and comply with languages and habits that the users are used to;
Consistent within interface: all elements should be consistent, such as: design style, icons and texts, position of elements, etc.
Operation feedback: enable the users to clearly perceive their operations by style updates and interactive effects;
Visual feedback: reflect current state by updating or rearranging elements of the page.
Simplify the process: keep operating process simple and intuitive;
Definite and clear: enunciate your intentions clearly so that the users can quickly understand and make decisions;
Easy to identify: the interface should be straightforward, which helps the users to identify and frees them from memorizing and recalling.
Decision making: giving advices about operations is acceptable, but do not make decisions for the users;
Controlled consequences: users should be granted the freedom to operate, including canceling, aborting or terminating current operation.
```
--------------------------------
### Element UI Pagination Component Examples
Source: https://context7.com/yidianhengji/pit-element-ui-doc/llms.txt
Illustrates different configurations of the Element UI Pagination component, including basic navigation, pagination with background, small size, full-featured layout with page size selection and jumper, and hiding the pagination when there's only one page. It shows how to handle page size and current page changes.
```html
```
--------------------------------
### Simple Steps
Source: https://github.com/yidianhengji/pit-element-ui-doc/blob/main/docs/en-US/steps.md
Shows how to apply a simple theme to the step bar. Attributes like 'align-center', 'description', 'direction', and 'space' are ignored in this theme.
```APIDOC
## Simple Step Bar
### Description
Simple step bars, where `align-center`, `description`, `direction` and `space` will be ignored. This theme is applied using the `simple` attribute.
### Method
N/A (Component Usage)
### Endpoint
N/A (Component Usage)
### Parameters
#### Component Attributes (el-steps)
- **simple** (boolean) - Optional - Whether to apply the simple theme. Defaults to `false`.
- **active** (number) - Required - The index of the current active step, starting from 0.
- **finish-status** (string) - Optional - The status of completed steps. Accepted values: 'wait', 'process', 'finish', 'error', 'success'. Defaults to 'finish'.
#### Component Attributes (el-step)
- **title** (string) - Required - The title of the step.
- **icon** (string) - Optional - The class name of the step icon.
### Request Example
```html
```
### Response
#### Success Response (N/A - Component Rendering)
N/A
#### Response Example
N/A
```
--------------------------------
### Element UI Upload Component Examples
Source: https://context7.com/yidianhengji/pit-element-ui-doc/llms.txt
Demonstrates various ways to use the Element UI Upload component, including basic file uploads, avatar uploads, photo walls, and drag-and-drop functionality. It covers event handling for preview, removal, success, error, and exceeding limits, as well as validation for avatar uploads.
```html
Click to upload
jpg/png files with a size less than 500kb
Drop file here or click to upload
```
--------------------------------
### Element UI Tree Basic Usage Example
Source: https://github.com/yidianhengji/pit-element-ui-doc/blob/main/docs/en-US/tree.md
Demonstrates the basic structure and data binding for the Element UI Tree component. It displays a hierarchical dataset and logs node click events. No external dependencies are required beyond Element UI.
```html
```
--------------------------------
### Element UI Date Range Picker: Setting Default Start and End Times
Source: https://github.com/yidianhengji/pit-element-ui-doc/blob/main/docs/en-US/date-picker.md
Illustrates how to set default time values for the start and end dates when using the `daterange` type of the El-Date-Picker component. The `default-time` attribute accepts an array of two strings, specifying the time for the start date and the end date respectively. By default, these are set to '00:00:00'.
```html
Component value:{{ value }}
```
--------------------------------
### Basic Usage
Source: https://github.com/yidianhengji/pit-element-ui-doc/blob/main/docs/en-US/steps.md
Demonstrates the basic usage of the el-steps component, including setting the active step and customizing the finish status.
```APIDOC
## Basic Usage
### Description
Demonstrates the basic usage of the el-steps component, including setting the active step and customizing the finish status.
### Method
N/A (Component Usage)
### Endpoint
N/A (Component Usage)
### Parameters
#### Component Attributes (el-steps)
- **active** (number) - Required - The index of the current active step, starting from 0.
- **finish-status** (string) - Optional - The status of completed steps. Accepted values: 'wait', 'process', 'finish', 'error', 'success'. Defaults to 'finish'.
- **space** (number / string) - Optional - The fixed width of each step in pixels or percentage. Responsive if omitted.
#### Component Attributes (el-step)
- **title** (string) - Required - The title of the step.
### Request Example
```html
Next step
```
### Response
#### Success Response (N/A - Component Rendering)
N/A
#### Response Example
N/A
```
--------------------------------
### Configure Default Time for Date Range Picker (Vue)
Source: https://github.com/yidianhengji/pit-element-ui-doc/blob/main/docs/en-US/datetime-picker.md
Demonstrates how to set default time values for the start and end dates when using the `datetimerange` type in Element Plus's `el-date-picker`. The `default-time` attribute accepts an array of strings, where the first element sets the start time and the second sets the end time. If only one value is provided, it applies to the start date.
```html
Start date time 12:00:00
Start date time 12:00:00, end date time 08:00:00
```
--------------------------------
### Element UI TimeSelect: Fixed Time Range
Source: https://github.com/yidianhengji/pit-element-ui-doc/blob/main/docs/en-US/time-picker.md
Allows selection of a start and end time from a fixed list. The end time selection is dynamically updated based on the chosen start time, using the `minTime` property within `picker-options`.
```html
```
--------------------------------
### Full On-Demand Import of All Element UI Components (JavaScript)
Source: https://github.com/yidianhengji/pit-element-ui-doc/blob/main/docs/en-US/quickstart.md
This comprehensive JavaScript example shows how to import and register nearly all available Element UI components and plugins individually using Vue.use() or Vue.prototype. This is typically done in a main.js file and is useful for projects that utilize a wide range of Element UI features, though it can increase initial load times if not managed carefully.
```javascript
import Vue from 'vue';
import {
Pagination,
Dialog,
Autocomplete,
Dropdown,
DropdownMenu,
DropdownItem,
Menu,
Submenu,
MenuItem,
MenuItemGroup,
Input,
InputNumber,
Radio,
RadioGroup,
RadioButton,
Checkbox,
CheckboxButton,
CheckboxGroup,
Switch,
Select,
Option,
OptionGroup,
Button,
ButtonGroup,
Table,
TableColumn,
DatePicker,
TimeSelect,
TimePicker,
Popover,
Tooltip,
Breadcrumb,
BreadcrumbItem,
Form,
FormItem,
Tabs,
TabPane,
Tag,
Tree,
Alert,
Slider,
Icon,
Row,
Col,
Upload,
Progress,
Spinner,
Badge,
Card,
Rate,
Steps,
Step,
Carousel,
CarouselItem,
Collapse,
CollapseItem,
Cascader,
ColorPicker,
Transfer,
Container,
Header,
Aside,
Main,
Footer,
Timeline,
TimelineItem,
Link,
Divider,
Image,
Calendar,
Backtop,
PageHeader,
CascaderPanel,
Loading,
MessageBox,
Message,
Notification
} from 'element-ui';
Vue.use(Pagination);
Vue.use(Dialog);
Vue.use(Autocomplete);
Vue.use(Dropdown);
Vue.use(DropdownMenu);
Vue.use(DropdownItem);
Vue.use(Menu);
Vue.use(Submenu);
Vue.use(MenuItem);
Vue.use(MenuItemGroup);
Vue.use(Input);
Vue.use(InputNumber);
Vue.use(Radio);
Vue.use(RadioGroup);
Vue.use(RadioButton);
Vue.use(Checkbox);
Vue.use(CheckboxButton);
Vue.use(CheckboxGroup);
Vue.use(Switch);
Vue.use(Select);
Vue.use(Option);
Vue.use(OptionGroup);
Vue.use(Button);
Vue.use(ButtonGroup);
Vue.use(Table);
Vue.use(TableColumn);
Vue.use(DatePicker);
Vue.use(TimeSelect);
Vue.use(TimePicker);
Vue.use(Popover);
Vue.use(Tooltip);
Vue.use(Breadcrumb);
Vue.use(BreadcrumbItem);
Vue.use(Form);
Vue.use(FormItem);
Vue.use(Tabs);
Vue.use(TabPane);
Vue.use(Tag);
Vue.use(Tree);
Vue.use(Alert);
Vue.use(Slider);
Vue.use(Icon);
Vue.use(Row);
Vue.use(Col);
Vue.use(Upload);
Vue.use(Progress);
Vue.use(Spinner);
Vue.use(Badge);
Vue.use(Card);
Vue.use(Rate);
Vue.use(Steps);
Vue.use(Step);
Vue.use(Carousel);
Vue.use(CarouselItem);
Vue.use(Collapse);
Vue.use(CollapseItem);
Vue.use(Cascader);
Vue.use(ColorPicker);
Vue.use(Transfer);
Vue.use(Container);
Vue.use(Header);
Vue.use(Aside);
Vue.use(Main);
Vue.use(Footer);
Vue.use(Timeline);
Vue.use(TimelineItem);
Vue.use(Link);
Vue.use(Divider);
Vue.use(Image);
Vue.use(Calendar);
Vue.use(Backtop);
Vue.use(PageHeader);
Vue.use(CascaderPanel);
Vue.use(Loading.directive);
Vue.prototype.$loading = Loading.service;
Vue.prototype.$msgbox = MessageBox;
Vue.prototype.$alert = MessageBox.alert;
Vue.prototype.$confirm = MessageBox.confirm;
Vue.prototype.$prompt = MessageBox.prompt;
Vue.prototype.$notify = Notification;
Vue.prototype.$message = Message;
```
--------------------------------
### Element UI Result Customized Content Example
Source: https://github.com/yidianhengji/pit-element-ui-doc/blob/main/docs/en-US/result.md
Shows how to customize the content of the Element UI Result component. This example uses a custom icon via the 'icon' slot and custom content in the 'extra' slot, displaying a 404 error message.
```html
Back
```
--------------------------------
### Element UI Fullscreen Loading Singleton Behavior
Source: https://github.com/yidianhengji/pit-element-ui-doc/blob/main/docs/en-US/loading.md
Illustrates the singleton pattern for fullscreen loading in Element UI. If multiple fullscreen loading services are invoked before the existing one is closed, the same instance is returned. This ensures only one fullscreen loader is active at a time.
```javascript
let loadingInstance1 = Loading.service({ fullscreen: true });
let loadingInstance2 = Loading.service({ fullscreen: true });
console.log(loadingInstance1 === loadingInstance2); // Output: true
// Closing either instance will close the single fullscreen loader.
```
--------------------------------
### Element UI Brand Color Display Example
Source: https://github.com/yidianhengji/pit-element-ui-doc/blob/main/docs/en-US/color.md
This example demonstrates how to display the primary brand color of Element UI within a Vue component. It utilizes the `tintColor` function to generate lighter shades of the primary color for visual effect and displays the hex value.
```html
```
--------------------------------
### Element UI Button Component Examples (HTML)
Source: https://context7.com/yidianhengji/pit-element-ui-doc/llms.txt
Demonstrates various ways to use the Element UI Button component, including different types, variants, sizes, loading states, disabled states, and button groups. It also shows icon integration.
```html
Default
Primary
Success
Warning
Danger
Info
Text Button
Plain
Round
Loading
Disabled
Medium
Small
Mini
Previous
Next
Search
```
--------------------------------
### Element UI Tooltip Basic Usage with 9 Placements
Source: https://github.com/yidianhengji/pit-element-ui-doc/blob/main/docs/en-US/tooltip.md
Demonstrates the basic usage of the Element UI Tooltip component, showcasing all 9 available placements (top-start, top, top-end, left-start, left, left-end, right-start, right, right-end, bottom-start, bottom, bottom-end). It utilizes the `content` attribute for prompt information and the `placement` attribute to control the tooltip's position relative to the hovered element. The example also includes basic styling for layout.
```html
top-start
top
top-end
left-start
left
left-end
right-start
right
right-end
bottom-start
bottom
bottom-end
```