april-ui-rust 0.1.0

April UI components for Laravel Rust and MiniJinja
Documentation
# April UI Rust

April UI components for Laravel Rust 0.1.0, rendered with MiniJinja and powered by Alpine.
This initial POC release includes 109 component templates. The API can change as Laravel Rust develops.
Livewire and the PHP package’s Artisan tooling are not included.

## Requirements

- Rust 1.99 or newer
- Node.js 22 or newer to build assets
- Laravel Rust 0.1.0 with its `minijinja` feature

## Local documentation

Keep [april-ui-docs-rust](../april-ui-docs-rust) beside this repository. Its Cargo path dependency uses this package directly.
It opens component documentation at `/`, with live previews, example source, and prop tables.

```sh
npm ci
npm run build
cd ../april-ui-docs-rust
npm ci
npm run build
cp .env.example .env # Only when .env does not exist.
cargo run -- key:generate
cargo run -- serve --host 127.0.0.1 --port 8788
```

Open http://127.0.0.1:8788. Restart the docs server after editing Rust or templates.
Rebuild the library assets after editing JavaScript. Rebuild docs CSS after editing example classes.

## Register the package

Add the local crate to the application's `Cargo.toml`:

```toml
[dependencies]
april-ui-rust = { path = "../april-ui-rust" }
# After the first crates.io release: april-ui-rust = "0.1.0"
```

Register its provider:

```rust
Application::configure()
    .with_providers(|providers| {
        providers.add(april_ui_rust::AprilUi);
    })
```

Load the stylesheet and standalone script in your MiniJinja layout:

```jinja
<link rel="stylesheet" href="{{ vendor_asset('april', 'april.css') }}">
<script defer src="{{ vendor_asset('april', 'april.js') }}"></script>
```

The provider embeds views and assets into the application binary.
Override templates in `resources/views/vendor/april/`. Override assets in `public/vendor/april/`.
Use your application's Tailwind build for classes you add to application templates.

## Components

Import the component namespace with `{% import "april::ui" as april %}`.
You can also import a macro from its component view. Hyphens in view names become underscores in macro names.
Every component also exports a `component` alias. `COMPONENTS` lists the package's view names.

```jinja
{% from "april::button" import button %}
{{ button("Save", attrs={"id":"save"}, variant="outline") }}
{% call button() %}<strong>Save changes</strong>{% endcall %}
```

The first argument supplies the main content. A native caller block supplies nested markup.
Use direct arguments such as `trigger`, `content`, `title`, and `description` for auxiliary content.
Use `attrs` for root attributes, and `trigger_attrs` or `content_attrs` where supported.
The port uses native MiniJinja conventions; it does not add Blade tags or named slots.
Plain strings are escaped. Capture composed markup with `{% set %}` or use a caller block.

```jinja
{% from "april::button" import button %}
{% from "april::dialog" import dialog %}
{% from "april::dialog-header" import dialog_header %}

{% set trigger %}{{ button("Edit profile") }}{% endset %}
{% call dialog(trigger=trigger, attrs={"dismissable":true}) %}
    {{ dialog_header(title="Edit profile", description="Update your details.") }}
    {{ button("Close", attrs={"x-bind":"closeButton"}) }}
{% endcall %}
```

The port retains the Alpine factories, keyboard behavior, form bindings, and theme from April UI.
Form components accept values and attributes directly. `input_group` takes an explicit `message` for validation output.
Interactive tables use `data`, `columns`, and the client-side table factory. Use `cellSlots` keyed by column key for custom cells.
The carousel's loop prop is `looping`, because MiniJinja reserves `loop`.

Attribute handling uses Laravel Rust's built-in `attributes()` helper.
The package uses the Rust `tw_merge` crate to resolve conflicting Tailwind utilities.
Custom PHP `tailwind_merge` configuration is not included.

## Existing Alpine applications

The standalone bundle starts Alpine and includes its focus, collapse, and anchor plugins.
For an application that already owns Alpine, import `registerApril` from `april.esm.js` instead.
Register the three Alpine plugins, call `registerApril(Alpine)`, then start Alpine once.

## Optional editor

Load `editor.js` before the standalone `april.js` script only on pages that render an editor.
TipTap stays out of the core bundle.
For an existing Alpine application, import `editor` from `editor.esm.js` and register it with `Alpine.data('editor', editor)`.

## Check

```sh
npm ci
npm run build
cargo test
cargo fmt --check
cargo clippy --all-targets -- -D warnings
npx playwright install chromium
npm run test:browser
```

The docs repository has browser checks for all component pages and interactions.
The package also retains a minimal example: `cargo run --example serve`.
The minimal package example uses `for_testing()` for temporary keys and in-memory services.
The docs app uses normal application configuration and its own `.env` file.

Livewire, its server-side data-table adapter, and PHP tooling are outside the current scope.
The crate pins Laravel Rust to 0.1.0. This is an independent port, not an official Laravel package.
The original April UI markup, theme, and JavaScript use the included MIT license.