# frappe-ui **Repository Path**: cn-frappe/frappe-ui ## Basic Information - **Project Name**: frappe-ui - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-02-09 - **Last Updated**: 2022-02-09 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Frappe UI A set of components and utilities for rapid UI development. Frappe UI components are built using Vue 3 and Tailwind. Along with components, it also ships with directives and utilities that make UI development easier.
Show components
## Installation ```sh npm install frappe-ui # or yarn add frappe-ui ``` Now, import the FrappeUI plugin and components in your Vue app's `main.js`: ```js import { createApp } from "vue"; import { FrappeUI, Button } from "frappe-ui"; import App from "./App.vue"; import "./index.css"; let app = createApp(App); app.use(FrappeUI); app.component("Button", Button); app.mount("#app"); ``` In your `tailwind.config.js` file, include the frappe-ui preset: ```js module.exports = { presets: [ require('frappe-ui/src/utils/tailwind.config') ], ... } ``` ## Components Frappe UI ships with a bunch of components. To use a component, you can import it directly from `frappe-ui`: ```html ``` You can also register components on the root `app` so that you don't have to import them in every component. `main.js` ```js import { createApp } from "vue"; import { Button, Input } from "frappe-ui"; let app = createApp(App); app.component("Button", Button); app.component("Input", Input); app.mount("#app"); ``` ### Alert ```html Your account has been created. ``` ### Avatar ```html ``` ### Badge ```html Open Completed Error Closed Running ``` ### Button ```html ``` ### Card ```html
Card content
``` ### Dialog The Dialog component uses `teleport` feature and requires `#modals` to exist. Make sure you add a `
` before the end of your body tag. ```html
Dialog content
``` ### Dropdown The Dropdown component uses `teleport` feature and requires `#popovers` to exist. Make sure you add a `
` before the end of your body tag. ```html ``` ### ErrorMessage ```html ``` ### FeatherIcon Uses [`feather-icons`](https://github.com/feathericons/feather) under the hood. ```html ``` ### GreenCheckIcon ```html ``` ### Input ```html ``` ### ListItem ```html ``` ### LoadingIndicator ```html ``` ### LoadingText ```html ``` ### Spinner ```html ``` ### SuccessMessage ```html ``` ## Directives ### onOutsideClick This directive is used when you want to execute a function when the user clicks outside of a target element. For e.g., when user clicks outside a dropdown, the dropdown should close. ```html ``` ## Utilities ### call This function wraps `fetch` API. It is built for making web requests to a Frappe server. ```js call('frappe.client.get_value', { doctype: 'ToDo', filters: {name: 'adsfasdf'}, fieldname: 'description' }) ``` ### resources This is a helper for managing async data fetching in Vue apps that work with a Frappe backend. ```html ``` ### socketio This module pre-configures a socketio instance on the port 9000. If you install the FrappeUI plugin, `this.$socket` will be available in all Vue components. Usage: ```js this.$socket.on('list_update', (data) => { // handle list update event }); ``` ### tailwind.config This is a [tailwind preset](https://tailwindcss.com/docs/presets) that customizes the standard tailwind config to include Frappe design tokens. Usage: ```js module.exports = { presets: [ require('frappe-ui/src/utils/tailwind.config') ], ... } ``` ## Vue Plugin Vue plugin that installs call, resources and socketio in your Vue app `main.js` ```js import { createApp } from "vue"; import { FrappeUI } from "frappe-ui"; import App from "./App.vue"; let app = createApp(App); app.use(FrappeUI); app.mount("#app"); ``` You can now use these features in your Vue components. ```html ``` ## License MIT