RippleUI

repository·main·Indexed 21 days ago

https://github.com/siumauricio/rippleui

A design system and component library built for Tailwind CSS, providing a collection of pre-styled, utility-first components. Version 1.12.1 includes components such as Buttons, Inputs, Modals, Navbars, and Tables, and can be integrated as a Tailwind CSS plugin with customizable themes and prefixes.

Tokens
56.6K
Snippets
206
Records
226
Agent score
74%

What's inside rippleui

  1. Layout Navbar with Start, Center, and End sections

    main

    You can control the alignment of elements within the navbar using three specific sub-containers:

    • navbar-start: Aligns elements to the left.
    • navbar-center: Aligns elements to the center.
    • navbar-end: Aligns elements to the right.

    To indicate an active link, use the navbar-active class on a navbar-item.

    <div className="navbar">
      <div className="navbar-start">
        <a className="navbar-item">Ripple UI</a>
      </div
      <div className="navbar-center">
        <a className="navbar-item">Home</a>
        <a className="navbar-item navbar-active">About</a>
        <a className="navbar-item">Contact</a>
      </div
      <div className="navbar-end ">
        <a className="navbar-item">Home</a>
      </div
    </div
  2. Structure a Sidebar with Title, Content, and Footer

    main

    A standard RippleUI sidebar is composed of three main sections:

    1. Sidebar Title (sidebar-title): Used for branding or application identity (e.g., logo and team name).
    2. Sidebar Content (sidebar-content): The primary navigation area. It typically contains a menu component with menu-section, menu-title, and menu-items.
    3. Sidebar Footer (sidebar-footer): Located at the bottom, often used for user profiles or settings, frequently utilizing a dropdown component.

    To ensure the content area is scrollable while the footer stays at the bottom, apply min-h-[20rem] (or similar) to the sidebar-content section.

    <aside class="sidebar sidebar-sticky">
      <section class="sidebar-title">
        <!-- Logo and App Name -->
      </section>
    
      <section class="sidebar-content">
        <nav class="menu">
          <!-- Navigation Links -->
        </nav>
      </section>
    
      <section class="sidebar-footer">
        <!-- User Profile / Settings -->
      </section>
    </aside>
  3. Understand the RippleUI Default Theme

    main

    RippleUI provides a default theme that supports both light and dark modes, which can be toggled using the toggle-icon. The theme is built upon RadixUI Colors as its foundation.

    By default, RippleUI applies the following styles to your application:

    • Page Background: Set to backgroundPrimary.
    • Page Text Color: Set to content1.

    If you wish to override these default background and text colors, you must refer to the Customization documentation to disable this behavior.

  4. Apply colors to the Progress component

    main

    You can customize the color of the progress bar by adding specific color utility classes. Ripple UI provides standard semantic colors and a 'flat' variant that changes the background color to match the theme.

    <!-- Standard Colors -->
    <progress class="progress progress-primary" value="50" max="100"></progress>
    <progress class="progress progress-secondary" value="50" max="100"></progress>
    <progress class="progress progress-success" value="50" max="100"></progress>
    <progress class="progress progress-warning" value="50" max="100"></progress>
    <progress class="progress progress-error" value="50" max="100"></progress>
    
    <!-- Flat Colors (different background colors) -->
    <progress class="progress progress-flat-primary" value="50" max="100"></progress>
    <progress class="progress progress-flat-secondary" value="50" max="100"></progress>
    <progress class="progress progress-flat-success" value="50" max="100"></progress>
    <progress class="progress progress-flat-warning" value="50" max="100"></progress>
    <progress class="progress progress-flat-error" value="50" max="100"></progress>
  5. Add titles and dividers to Menu sections

    main

    To organize complex menus, you can group items into sections with titles and visual separators:

    • Section Titles: Use a <span> with the menu-title class inside a menu-section to label a group of items.
    • Dividers: Use a <div> with the divider class between menu-section elements to create a visual break.
    <nav className="menu bg-gray-2 p-4 rounded-md">
        <section className="menu-section">
            <span className="menu-title">Main menu</span>
            <ul className="menu-items">
                <li className="menu-item">General</li>
            </ul>
        </section>
        
        <div className="divider my-0"></div>
    
        <section className="menu-section">
            <span className="menu-title">Settings</span>
            <ul className="menu-items">
                <li className="menu-item">Profile</li>
            </ul>
        </section>
    </nav>
  6. Build standard forms with Ripple UI classes

    main

    Ripple UI provides a set of CSS classes to structure and style forms. To create a standard form, use the following class hierarchy:

    • form-group: A container for a collection of form fields.
    • form-field: A container for an individual input field, its label, and optional validation messages.
    • form-label: Used for the input's label text.
    • form-label-alt: Used for secondary label text, such as validation error messages or helper text.
    • form-control: A wrapper used to control the layout and alignment of elements within a field (e.g., for checkboxes or button alignment).
    • input: The base class for input elements.
    • checkbox: The class for checkbox inputs.
    • btn: The base class for buttons, often combined with modifiers like btn-primary.
    <div class="form-group">
        <div class="form-field">
            <label class="form-label">Email address</label>
            <input type="email" class="input" />
            <label class="form-label">
                <span class="form-label-alt">Please enter a valid email.</span>
            </label>
        </div>
    </div>
  7. Prevent closing Modal on overlay click

    main

    To prevent the modal from closing when a user clicks on the background overlay, simply omit the htmlFor attribute from the <label className="modal-overlay"> element. The modal will then only close via explicit close buttons (like a 'Cancel' button or an 'X' icon) that target the checkbox ID.

    <label className="btn btn-primary" htmlFor="modal-3">Open Modal</label>
    <input className="modal-state" id="modal-3" type="checkbox" />
    <div className="modal">
    <label className="modal-overlay"></label> <!-- No htmlFor attribute here -->
    <div className="modal-content flex flex-col gap-5">
        <label htmlFor="modal-3" className="btn btn-sm btn-circle btn-ghost absolute right-2 top-2">✕</label>
        <h2 className="text-xl">Modal title 3</h2>
        <div className="flex gap-3">
        <button className="btn btn-error btn-block">Delete</button>
        <button className="btn btn-block">Cancel</button>
        </div>
    </div>
    </div>
  8. Manage the React application with npm scripts

    main

    The my-react-app example uses standard Create React App scripts to manage the development lifecycle. Use these commands in the project directory to start development, run tests, or build for production.

    # Run the app in development mode
    npm start
    
    # Launch the test runner in interactive watch mode
    npm test
    
    # Build the app for production
    npm run build
    
    # Eject from the build tool configuration (one-way operation)
    npm run eject