Luxe
repository·main·Indexed 21 days ago
https://github.com/guhrodrrigues/luxeA component library providing high-quality, copy-and-paste UI elements for building sophisticated applications. It includes a CLI for project initialization and component installation via `npx luxe init` and `npx luxe add`. Featured components include Accordion, AnimatedTabs, and Avatar, built with Radix UI primitives and Tailwind CSS.
What's inside luxe
- Luxe is a library of copy-and-paste components designed to provide elegant and sophisticated UI elements for applications. It is intended to help developers build interfaces quickly while maintaining high visual style.
Customize components using variant props
mainLuxe 2.0 introduces
variantprops to simplify component customization. Instead of importing specialized components for specific styles, you can pass a variant name directly to the base component.For example, instead of importing
ButtonGlitchBrightness, you can use the standardButtoncomponent with theglitch-brightnessvariant.Supported components with
variantprops include:ButtonBadgeCardText
// Example of using a variant prop on a Button <Button variant="glitch-brightness">Click Me</Button> // The Button component supports these variants: // shine, animated-border, rotate-border, magnetic, default, outline, success, destructive // For the 'magnetic' variant, use the 'isMagnetic' prop: <Button variant="magnetic" isMagnetic>Magnetic Button</Button>Luxe 2.0 Core Technologies
mainLuxe 2.0 components are built using the following technologies:
- Radix UI Primitives: For accessible component logic.
- Tailwind CSS v4: For styling.
- Motion Preferences: Components respect user system motion preferences.
Use MultiStepModal components
mainThe
MultiStepModalcomponent consists of three main parts:MultiStepModal: The root container.MultiStepModalTrigger: The element that triggers the modal opening. It supports theasChildprop to merge its functionality with a custom child component (like aButton).MultiStepModalContent: The content container that renders the steps. It accepts astepsprop which is an array of objects with the shape{ title: string; description: string; }.
const steps = [ { title: "Step 1", description: "Description of step 1"}, { title: "Step 2", description: "Description of step 2" } ] <MultiStepModal> <MultiStepModalTrigger> Multi Step Modal Trigger </MultiStepModalTrigger> <MultiStepModalContent steps={steps} /> </MultiStepModal>Install the Card component via CLI
mainThe fastest way to add the Card component to your project is using the Luxe CLI. This will automatically handle the component addition and necessary dependencies.
npx luxe add card # or pnpm dlx luxe add card # or yarn npx luxe add card # or bunx --bun luxe add cardManual Installation of Checkbox
mainIf you prefer to install the Checkbox component manually, follow these steps:
- Install dependencies: You need
motion,@radix-ui/react-checkbox,clsx, andtailwind-merge. - Copy the component code: Create a
checkbox.tsxfile and paste the provided component implementation. - Setup utility function: Ensure you have a
cnutility function inutils/cn.tsfor class merging. - Configure CSS variables: Add the required color variables (
--main-muted,--primary,--primary-invert,--border) to your CSS file and map them to your Tailwind theme. - Adjust imports: Update the import paths in
checkbox.tsxto match your project's directory structure.
npm i motion @radix-ui/react-checkbox clsx tailwind-merge- Install dependencies: You need
Install the Accordion component via CLI
mainThe fastest way to add the Accordion component to your project is using the
luxeCLI. This will automatically handle the installation of necessary dependencies and component files.npx luxe add accordion # or pnpm dlx luxe add accordion # or yarn npx luxe add accordion # or bunx --bun luxe add accordionInitialize your project with luxe init
mainUse the
initcommand to perform the initial setup for Luxe in your project. This command automates several setup steps, including:- Installing required dependencies.
- Configuring CSS variables.
- Adding the
cnutility (typically used for class name merging).
npx luxe init # or pnpm dlx luxe init # or yarn luxe init # or bunx --bun luxe initUse the Accordion component
mainThe Accordion component allows you to display a series of collapsible sections. It is built on top of Radix UI primitives and supports both single and multiple expansion modes.
Basic Usage
Import the necessary sub-components and wrap your items in the
Accordionroot component. Usetype="single"for single-item expansion andtype="multiple"for multiple items. Thecollapsibleprop allows the currently open item to be closed by clicking its trigger.Component API
Accordion: The root container. Controls the expansion mode viatype(single|multiple) and manages the currently active item viadefaultValueorvalue.AccordionItem: A wrapper for each accordion section. Requires a uniquevalueprop.AccordionTrigger: The clickable element that toggles the visibility of the content.AccordionContent: The container that holds the collapsible content.
import { Accordion, AccordionItem, AccordionTrigger, AccordionContent, } from "@/components/ui/accordion"; export function AccordionExample() { return ( <Accordion className="w-[400px]" type="single" defaultValue="item-1" collapsible > <AccordionItem value="item-1"> <AccordionTrigger>Is it accessible?</AccordionTrigger> <AccordionContent> Yes. It adheres to the WAI-ARIA design pattern. </AccordionContent> </AccordionItem> <AccordionItem value="item-2"> <AccordionTrigger>Is it unstyled?</AccordionTrigger> <AccordionContent> Yes. It's unstyled by default, giving you freedom over the look and feel. </AccordionContent> </AccordionItem> </Accordion> ); }Install Dropdown Menu manually
mainIf you prefer to install the component manually, you must first install the required peer dependencies:
motion,@radix-ui/react-slot,clsx, andtailwind-merge.npm i motion @radix-ui/react-slot clsx tailwind-merge # or pnpm add motion @radix-ui/react-slot clsx tailwind-merge # or yarn add motion @radix-ui/react-slot clsx tailwind-merge # or bun add motion @radix-ui/react-slot clsx tailwind-mergeManual installation of Input OTP
mainIf you prefer to install the component manually, follow these steps:
- Install dependencies: You need
input-otp,motion,clsx, andtailwind-merge. - Add the component code: Copy the
input-otp.tsximplementation into your project. - Setup utility: Ensure you have a
utils/cn.tsfile for class merging. - Configure CSS: Add the required CSS variables and animations to your global CSS file.
- Adjust imports: Update the import paths in the copied component to match your project's directory structure.
npm i input-otp motion clsx tailwind-merge- Install dependencies: You need
Add required CSS variables for Dropdown Menu
mainTo ensure correct styling and theme support (including dark mode), add the following CSS variables to your global CSS file. This configuration uses OKLCH colors and defines them for Tailwind CSS via the
@theme inlinedirective.:root { --main-secondary: oklch(97% 0 0); --main-foreground: oklch(0.925 0 0); --primary-foreground: oklch(37.1% 0 0); --primary-muted: oklch(0.556 0 0); --border: oklch(0.885 0 0); } .dark { --main-secondary: oklch(0.205 0 0); --main-foreground: oklch(0.269 0 0); --primary-foreground: oklch(0.97 0 0); --primary-muted: oklch(0.708 0 0); --border: oklch(0.26 0 0); } @theme inline { --color-main-secondary: var(--main-secondary); --color-main-foreground: var(--main-foreground); --color-primary-foreground: var(--primary-foreground); --color-primary-muted: var(--primary-muted); --color-border: var(--border); }