Varlet Documentation

repository·dev·Indexed 26 days ago

https://github.com/varletjs/varlet

A Vue 3 component library based on Material Design 2 and 3, supporting both mobile and desktop environments. Features over 70 lightweight components with theme customization, internationalization, and SSR support. Includes the @varlet/cli for scaffolding component libraries, a VSCode extension for productivity, and a comprehensive ecosystem including touch-emulator, import-resolver, and theme builder.

Tokens
315.1K
Snippets
805
Records
1.6K
Agent score
84%

What's inside Varlet

  1. Overview of Varlet Component Library

    dev

    Varlet is a Vue3 component library built on Material Design 2 and 3. It is designed to support both mobile and desktop environments.

    Key features include:

    • Over 60 high-quality, lightweight general-purpose components.
    • Support for on-demand component introduction (tree-shaking).
    • Theme customization and dark mode support.
    • Internationalization (i18n) support.
    • TypeScript support and SSR (Server-Side Rendering) compatibility.
    • Nuxt Module support via varlet-nuxt.
    • Accessibility support (ongoing improvements).
  2. Overview of Varlet UI

    dev

    Varlet is a Vue3 component library based on Material Design 2 and 3. It is designed to support both mobile and desktop environments and is maintained by the varletjs organization.

    Key Features

    • High Quality: Provides 60+ lightweight, high-quality general-purpose components.
    • Flexible Integration: Supports on-demand imports (tree-shaking), theme customization, and internationalization.
    • Modern Development: Built with TypeScript, supports SSR (Server-Side Rendering), and includes a Nuxt Module.
    • Design Systems: Supports both Material Design 2 and Material Design 3.
    • Developer Experience: Supports dark mode, provides an official VSCode extension, and offers WebStorm component attribute highlighting.
  3. Explore the Varlet Ecosystem

    dev

    Varlet provides several official tools to enhance development:

    • @varlet/cli: Rapid prototyping tool for Vue3 component libraries.
    • @varlet/touch-emulator: Desktop adapter for mobile component compatibility.
    • @varlet/import-resolver: Resolver for unplugin-vue-components to enable on-demand component imports.
    • @varlet/ui-playground: Online editing tool for testing components.
    • @varlet/preset-unocss & @varlet/preset-tailwindcss: CSS presets for Varlet.
    • varlet-theme-builder: Generator for Material Design 3 theme variables.
    • varlet-vscode-extension: Official VSCode plugin for Varlet.
  4. Explore the Varlet UI Ecosystem

    dev

    Varlet provides several official tools and packages to enhance your development experience:

    • @varlet/cli: Tools for rapid Vue3 component library development.
    • @varlet/touch-emulator: Desktop adapter to allow mobile components to run on desktop.
    • @varlet/ui-playground: Online editor for Varlet components.
    • @varlet/import-resolver: Resolver for unplugin-vue-components to enable on-demand imports.
    • @varlet/preset-unocss: UnoCSS preset for Varlet.
    • @varlet/preset-tailwindcss: TailwindCSS preset for Varlet.
    • varlet-theme-builder: Theme generator for Material Design 3 variables.
    • varlet-vscode-extension: Official VSCode extension.
    • varlet-app-example: Mobile application template.
  5. Customize component property defaults with setPropsDefaults

    dev

    Varlet UI allows you to customize the default values for component props using the static method setPropsDefaults.

    Important constraints:

    1. This only affects declarative components (components used in templates).
    2. Customization must be performed before the component is initialized (e.g., in your main.ts entry point).
    import { Button } from '@varlet/ui'
    
    // Set default props for all Button components
    Button.setPropsDefaults({
      type: 'primary',
      elevation: 10
    })