XMLUI Framework

repository·main·Indexed 42 days ago

https://github.com/xmlui-org/xmlui

A declarative UI framework that uses XML markup to build themed, connected web applications with minimal scripting. It features a core engine, data binding via DataSource, and specialized packages including xmlui-echart for GeoJSON maps, xmlui-react-flow for declarative diagrams with a canvas API, and xmlui-ai-blocks for AI components. The ecosystem includes a VS Code extension for syntax highlighting and diagnostics, and a preview-ssg tool for static site generation.

Tokens
1M
Snippets
2.3K
Records
3.5K
Agent score
45%

What's inside XMLUI

  1. What is XMLUI?

    main

    XMLUI is a framework for building user interfaces declaratively using XML markup and flexible theming. It allows developers to build modern web applications with little to no knowledge of React or CSS.

    Key characteristics include:

    • Declarative Markup: Use XML tags and attributes to define the UI.
    • Component-Based: Use a modular suite of components like <App>, <List>, and <Text>.
    • Data-Driven: Use the data property on components to fetch JSON from URLs.
    • No Build Step: Unlike React, the XMLUI engine loads and renders XMLUI files directly in the browser, making deployment as simple as hosting static files.
  2. Overview of XMLUI Integration Test App build modes

    main

    The xmlui-integration-test-app supports five distinct runtime modes. Choose a mode based on your testing or development needs:

    Modenpm scriptOutputServes via
    Standalone (buildless)setup:standalone + servepublic/js/ (copied UMDs)serve . -s
    Vite dev serverstart—Vite HMR
    Vite production buildbuilddist/preview / serve dist
    SSG buildbuild-ssg / ssgdist-ssg/preview-ssg dist-ssg
    Vite plugin-mode buildbuild:plugin-modedist-vite-plugin/serve dist-vite-plugin
  3. Use the Icon component

    main

    The Icon component displays scalable vector icons from XMLUI's built-in registry using name-based lookups. It is suitable for buttons, navigation, and status indicators.

    Key Capabilities:

    • Name-based lookup: Reference icons by unique, case-sensitive names (e.g., message, cog, trash).
    • Fallback support: Provide a backup icon name if the primary name is not found in the registry.
    • Sizing: Use predefined sizes (xs, sm, md, lg) or custom dimensions.
    • Interactivity: Supports click events for creating icon buttons.
    <App>
      <Icon name="message" />
    </App>
  4. Use the DatePicker component

    main

    The DatePicker component provides an interactive calendar interface for selecting single dates or date ranges. It renders a text input that triggers a calendar popup upon interaction, supporting both keyboard and mouse input.

    Key Features

    • Flexible modes: Supports single date selection (default) or date range selection.
    • Format customization: Supports various date formats (e.g., MM/dd/yyyy, yyyy-MM-dd).
    • Date restrictions: Allows setting minimum/maximum dates and disabling specific dates.
    • Localization: Configurable first day of the week and visibility of week numbers.

    Data Model

    The component uses the following context variable for its value:

    • value:
      • In single mode: returns a string.
      • In range mode: returns an object { from, to }.
    // Example of expected value shapes
    // Single mode:
    const value = "2023-10-27";
    
    // Range mode:
    const value = { from: "2023-10-01", to: "2023-10-07" };
  5. Use the Button component

    main

    Button is the primary interactive component for triggering actions like form submissions, navigation, opening modals, and API calls. It supports multiple visual styles and sizes to match different UI contexts and importance levels.

    Key features:

    • Visual hierarchy: Choose from solid, outlined, or ghost variants to indicate importance.
    • Theme colors: Use primary, secondary, or attention colors for different action types.
    • Icon support: Add icons before or after text, or create icon-only buttons.
    • Form integration: Automatically handles form submission when used in forms.