Intent UI Blocks Docs: Laravel
Learn how to seamlessly integrate and utilize Intent UI Blocks within the Laravel and Inertia.js to build interactive applications effortlessly.
Installation
The installation process is straightforward and easy to follow. Just follow the steps below to get started:
1Initial setup
Run the following command in your terminal:
When you execute this command, you'll be guided through the process of selecting your desired framework. Since we’re using Laravel, choose Laravel
from the options. You’ll then encounter a series of prompts; for this example, simply select "Yes" for all to proceed quickly.
The project name defaults to app
, but you can customize it to suit your preferences.
Once everything is configured correctly, you'll see an output similar to this:
2File and Folder
After completing the initial setup, your project structure will include several pre-configured features like authentication, thanks to the default Breeze setup with the Inertia.js React adapter. Additionally, you'll find a intentui.json
file in the root directory, as well as folders added by Intent UI, such as resources/js/Components/ui
and resources/js/utils
. The app.css
file will also be updated to incorporate Intent UI variables and styles.
Here’s what Intent UI specifically includes: a providers.tsx
, a theme-provider.tsx
, and the ui
folder containing index.ts
and primitive.tsx
.
3Providers
Inside the Components
folder, you'll find the providers.tsx
and theme-provider.tsx
files.
To utilize the provider, import it into your resources/js/app.tsx
file.
4Done
You're now ready to start creating your blocks.
Modify Login Page
If you open your project and navigate to /login
, you'll notice a plain and unstyled login page. This happens because there’s no tailwind.config.js
file. Don’t worry—since we’re using Tailwind CSS v4, it’s not required.
Now, let’s enhance the login page by using Intent UI components. Start by opening your terminal and adding the text-field, checkbox, and button components, as these are needed for the login page.
The output will look something like this:
You might wonder why five components are created even though we only added three. This happens because some components are interconnected and rely on one another.
Before proceeding further, update the tsconfig.json
and vite.config.js
files by modifying the ui
key as shown below:
Next, let’s update the login page. Open the resources/js/Pages/Auth/Login.tsx
file and replace its content with the following code:
For more details about using the CLI, please visit the CLI documentation.
Starter Kit
If you’d like to explore the Intent UI Starter Kit, visit the GitHub repository at intentuilabs/inertia.ts. This repository offers a fully functional Laravel project with Intent UI pre-installed and configured, including a range of components and utilities.