### Install adonisjs-ui Package
Source: https://github.com/kabbouchi/adonisjs-ui/blob/master/README.md
This command installs the adonisjs-ui package using the AdonisJS CLI. Ensure you have Node.js and npm/yarn installed.
```shell
node ace add adonisjs-ui
```
--------------------------------
### AdonisJS UI Button Component Examples
Source: https://context7.com/kabbouchi/adonisjs-ui/llms.txt
Demonstrates the usage of the Button component in AdonisJS UI, showcasing various variants (primary, danger, ghost, outline), sizes, icon integration, and loading states. These examples highlight the flexibility and customization options available for buttons.
```edge
{{-- Basic button with primary variant --}}
@ui.button({ variant: 'primary', size: 'base' })
Click Me
@end
{{-- Danger button with loading state --}}
Delete Account
{{-- Ghost button with icon --}}
@component("ui::button", {
variant: 'ghost',
size: 'sm',
icon: 'heroicons:plus'
})
Add New
@end
{{-- Square icon button --}}
{{-- Button with custom loading state --}}
Save Changes
```
--------------------------------
### AdonisJS Dropdown Component Examples
Source: https://context7.com/kabbouchi/adonisjs-ui/llms.txt
Illustrates the usage of the Dropdown component in AdonisJS Edge templates for creating interactive menus. Examples include a basic dropdown with links, a dropdown with custom alignment and width, and a user menu dropdown integrated with authentication.
```edge
{{-- Basic dropdown --}}
@slot('trigger')
Options
@end
@slot('content')
ProfileSettingsLogout
@end
{{-- Dropdown with custom alignment and width --}}
@slot('trigger')
@end
@slot('content')
Quick Actions
Action 1Action 2
@end
{{-- User menu dropdown --}}
@component("ui::dropdown/index", { align: 'top-14', width: 'w-56' })
@slot('trigger')
@end
@slot('content')
{{ auth.user.name }}
{{ auth.user.email }}
DashboardLogout
@end
@end
```
--------------------------------
### AdonisJS UI Badge Component Examples
Source: https://context7.com/kabbouchi/adonisjs-ui/llms.txt
Provides examples of the Badge component in AdonisJS UI, demonstrating its use for displaying status indicators and labels. Covers different color schemes, shape variants (soft, solid, pill), sizes, and how to render multiple badges in a row or as part of interactive elements.
```edge
{{-- Default badge --}}
New
{{-- Colored badges with variants --}}
ActiveUrgentBeta
{{-- Different sizes --}}
@ui.badge({ color: 'purple', size: 'sm', label: 'Small' })
@end
@ui.badge({ color: 'orange', size: 'lg', label: 'Large' })
@end
{{-- Multiple badges in a row --}}
VerifiedPremiumLimited
{{-- Badge as button --}}
```
--------------------------------
### AdonisJS UI Input Component Examples
Source: https://context7.com/kabbouchi/adonisjs-ui/llms.txt
Illustrates the various configurations and features of the Input component in AdonisJS UI, including labels, descriptions, validation error handling (integrated with flash messages), different variants (outline, filled), and size adjustments. These examples show how to create accessible and functional input fields.
```edge
{{-- Basic input with label --}}
{{-- Input with description --}}
@ui.input({
name: 'username',
label: 'Username',
description: 'Choose a unique username for your account',
variant: 'outline',
size: 'md'
})
@end
{{-- Input with validation (automatic error display) --}}
{{-- Filled variant input --}}
{{-- Compact input without wrapper --}}
@component("ui::input", {
name: 'code',
type: 'text',
size: 'xs'
})
@end
```
--------------------------------
### Configure AdonisJS UI Provider
Source: https://context7.com/kabbouchi/adonisjs-ui/llms.txt
Configures the AdonisJS UI provider within your AdonisJS application. This setup step is crucial for the UI components to be recognized and rendered correctly by the framework.
```typescript
import { configure } from "adonisjs-ui";
// The configure function automatically registers the UI provider
await configure(command);
```
--------------------------------
### AdonisJS Table Component Examples
Source: https://context7.com/kabbouchi/adonisjs-ui/llms.txt
Demonstrates the implementation of the Table component in AdonisJS Edge templates. It showcases basic table structure, tables with pagination utilizing database queries, and responsive tables with custom styling. Requires AdonisJS and its Edge templating engine.
```edge
{{-- Basic table structure --}}
NameEmailStatusJohn Doejohn@example.comActive
{{-- Table with pagination --}}
@let(users = await User.query().paginate(page, 15))
IDUsernameCreated
@each(user in users)
{{ user.id }}{{ user.username }}{{ user.createdAt.toFormat('yyyy-MM-dd') }}
@endeach
{{-- Responsive table with custom styling --}}
@component("ui::table", { class: 'mt-6' })
@!component("ui::table/columns")
@!component("ui::table/column")Name@end
@!component("ui::table/column")Actions@end
@end
@end
```
--------------------------------
### AdonisJS Select Component Examples
Source: https://context7.com/kabbouchi/adonisjs-ui/llms.txt
Shows how to implement the Select component in AdonisJS Edge templates for form inputs. Covers basic select elements, selects with validation integration, multiple select options, and different variant styles like 'filled' and 'outline'.
```edge
{{-- Basic select --}}
{{-- Select with validation --}}
{{-- Multiple select --}}
@each(category in categories)
@endeach
{{-- Filled variant select --}}
@component("ui::select", {
name: 'status',
variant: 'filled',
size: 'md'
})
@end
```
--------------------------------
### Navigation List Component (Edge)
Source: https://context7.com/kabbouchi/adonisjs-ui/llms.txt
Illustrates the creation of navigation menus using the navlist component. Examples cover basic lists, nested groups, badges for item counts, and active state management, all within the Edge templating language.
```edge
{{-- Basic navigation list --}}
DashboardUsersSettings
{{-- Navigation with groups and badges --}}
@component("ui::navlist/index")
@!component("ui::navlist/group", { title: 'Main' })
@!component("ui::navlist/item", { href: '/dashboard' })
Dashboard
@slot('trailing')
@!component("ui::navlist/badge")3@end
@end
@end
@!component("ui::navlist/item", { href: '/projects' })
Projects
@end
@end
@!component("ui::navlist/group", { title: 'Settings' })
@!component("ui::navlist/item", { href: '/profile' })
Profile
@end
@!component("ui::navlist/item", { href: '/preferences' })
Preferences
@end
@end
@end
```
--------------------------------
### Typography Components: Heading, Subheading (Edge)
Source: https://context7.com/kabbouchi/adonisjs-ui/llms.txt
Illustrates the use of heading and subheading components for structuring content with consistent styling. Examples include standalone page headings, section headings with subheadings, and hierarchical usage.
```edge
{{-- Page heading --}}
Dashboard Overview
{{-- Section heading with subheading --}}
User SettingsManage your account preferences and profile information
{{-- Multiple levels --}}
@ui.heading()
Account Management
@end
@ui.subheading()
Configure your account settings below
@end
```
--------------------------------
### Separator Component (Edge)
Source: https://context7.com/kabbouchi/adonisjs-ui/llms.txt
Demonstrates the basic usage and application of the separator component for visually dividing content sections. Examples show standalone usage and placement between different content blocks or list items.
```edge
{{-- Basic separator --}}
{{-- Between sections --}}
Section 1 content
Section 2 content
{{-- In a list --}}
Item 1
@component("ui::separator")
@end
Item 2
```
--------------------------------
### Global $ui Helper for Styling (Edge)
Source: https://context7.com/kabbouchi/adonisjs-ui/llms.txt
Shows how to leverage the global $ui helper in Edge templates to access and apply component styling functions directly. Examples include customizing button, input, and badge components with dynamic styles and combining them with custom classes.
```edge
{{-- Use TV functions directly --}}
@let(buttonStyles = $ui.button())
{{-- Access input styles --}}
@let(inputStyles = $ui.input({ invalid: true }))
{{-- Combine with custom classes --}}
@let(badgeStyles = $ui.badge())
Status
```
--------------------------------
### Render UI Button Component
Source: https://github.com/kabbouchi/adonisjs-ui/blob/master/README.md
Demonstrates multiple ways to render a primary button using the adonisjs-ui package within Edge templates. It shows direct Edge syntax, component usage, and integration with `edge-tags` for a more HTML-like syntax. Ensure the UI package is properly installed and imported.
```edge
@ui.button({ type: 'primary' })
Button
@end
```
```edge
@component("ui::button", { type: 'primary' })
Button
@end
```
```edge
Button
```
```edge
Button
```
--------------------------------
### Form Components: Label, Description, Error (Edge)
Source: https://context7.com/kabbouchi/adonisjs-ui/llms.txt
Demonstrates the usage of standalone label, description, and error components for form inputs. It also shows a complete field example integrating all helpers and custom styled errors using Edge component syntax.
```edge
{{-- Standalone label --}}
Full Name
{{-- Description text --}}
Your password must be at least 8 characters long
{{-- Error message display --}}
{{-- Complete field with all helpers --}}
Email AddressWe'll never share your email
{{-- Custom styled error --}}
@component("ui::error", {
name: 'password',
class: 'text-sm font-bold'
})
@end
```
--------------------------------
### Custom Tag Syntax Conversion (Edge)
Source: https://context7.com/kabbouchi/adonisjs-ui/llms.txt
Explains the custom tag compiler that converts HTML-like syntax into Edge component calls. It provides equivalent examples for button and separator components, including self-closing tags, bound attributes, and dynamic values.
```edge
{{-- All three syntaxes are equivalent --}}
{{-- HTML-like syntax (compiled by UiTagCompiler) --}}
Click Me
{{-- Edge component syntax --}}
@component("ui::button", { type: 'primary' })
Click Me
@end
{{-- Edge shorthand syntax --}}
@ui.button({ type: 'primary' })
Click Me
@end
{{-- Self-closing tags --}}
{{-- Bound attributes with colon --}}
Submit
{{-- Dynamic values with double curly braces --}}
{{ user.statusLabel }}
```
--------------------------------
### Textarea Component (Edge)
Source: https://context7.com/kabbouchi/adonisjs-ui/llms.txt
Shows how to implement textarea components, including basic usage, validation support, and different styling variants like 'outline' and 'filled'. It also demonstrates custom component invocation with parameters.
```edge
{{-- Basic textarea --}}
{{-- Textarea with validation --}}
{{-- Filled variant --}}
@component("ui::textarea", {
name: 'notes',
label: 'Notes',
variant: 'filled',
rows: 6
})
@end
```
--------------------------------
### Import Tailwind CSS and AdonisJS UI
Source: https://github.com/kabbouchi/adonisjs-ui/blob/master/README.md
This CSS snippet imports Tailwind CSS and adonisjs-ui into your main CSS file. This is necessary for the UI components to be styled correctly. Ensure the path `resources/css/app.css` is your project's main CSS entry point.
```css
/* resources/css/app.css */
@import "tailwindcss";
@import "adonisjs-ui";
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.