- npm:
npm install imba-inertia-adapter
- pnpm:
pnpm add imba-inertia-adapter
- yarn :
yarn add imba-inertia-adapter
https://github.com/haikyuu/perfect-stack
For more documentation, please refer to inertia.js website. As the frontend adapters are quite similar in usage.
This will be the entry point for your app
import { createInertiaApp } from 'imba-inertia-adapter'
createInertiaApp
resolve: do(name) name
setup: do({ el, App, props })
imba.mount <{App} props=props>
Those two components are automatically registered when you import from the main entry point.
They have the same attributes as their react/vue counterparts except as
which is currently unsupported. Instead use the inertia-button-link
.
<inertia-button-link href="/login" method="delete"> "Logout"
<inertia-link href="/users"> "users"
import { Form } from 'imba-inertia-adapter'
tag edit-contacts-page
prop props
def setup
const {last_name = "", first_name = ""} = props.contact;
self.form = new Form
first_name: first_name
last_name: last_name
def render
const {contact} = props
<self>
"Loading" if form.processing
<form @submit.prevent=form.put("/contacts/{contact.id}")>
<input bind=form.data.first_name error=form.errors.first_name>
<button type="submit"> "Submit"
#context.currentPage.page.props
If your backend adapter supports them, they can be accessed like regular props
#context.currentPage.page.props.flash
#or
props.flash
- You can change forms by simple assignment:
form.data.name = "Abdellah"
MIT License.