jakeydevs / form-components
基于 Tailwind UI 的有偏见的 Laravel 表单组件
Requires
- php: >=7.4
README
基于 Tailwind UI 的输入和设计元素表单包 - 非常有偏见!
安装
composer require jakeydevs/form-components
然后你需要发布组件,这样 Tailwind 就可以获取样式了
php artisan publish:vendor
在你的页面模板中添加一个新的堆栈,这将允许使用任何 JavaScript。所有包含的 JS 库都从 CDN 加载
@stack('forms-head')
@stack('forms-js')
组件
表单部分
用于围绕表单提供设计框架。SLOT 应用于表单内容
<x-form-components-section title="test" description="test descreiption" type="stacked" />
表单输入
主要的 HTML 输入。可以是不同的类型(文本、datetime-local、数字等)
<x-form-components-input name="published_at" type="datetime-local" label="文章发布日期" help="帮助" :bind="@$article" :value="now()->subMinutes(10)"/>
任何额外的属性都会直接附加到 Input 上,如 required 和 value(默认)
选择
带有下拉菜单的选择框
<x-form-components-select
name="select-model"
label="Models"
help="Eloquent"
:bind="@$article"
:options="$users"
track="name"
display="email"
:value="$users->last()->name"
/>
任何额外的属性都会直接附加到 SELECT 上,如 required
复选框
复选框的切换框
<x-form-components-checkbox name="active" label="使文章活跃" help="帮助" :bind="@$article" />
可以使用值作为强制默认的方式