Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Form Components Laravel Package

rawilk/laravel-form-components

A set of reusable Blade form components for Laravel that make building consistent forms quick and clean. Includes inputs, selects, checkboxes, radios, buttons, errors, and styling-friendly markup, with flexible config and easy customization.

View on GitHub
Deep Wiki
Context7

title: Extra Attributes sort: 5

Introduction

There may be times when you are rendering an input component where you may have an unknown amount of attributes you need to pass to the component. The most common use case I have for it is when I'm building up an array of attributes for a component, and some attributes are conditional on what I send to the component.

The current blade syntax doesn't allow for using conditional logic like [@if](https://github.com/if) when you're rendering a blade component, so I've come up with a prop called extraAttributes on most of the components offered by this package. This will allow you to pass an array of attributes to the element, and the element will then render them onto the applicable element for you.

Basic Usage

Here's an arbitrary example of how one could build up an array of attributes in a Livewire component, and then pass them to an input component.

public function getInputAttributesProperty(): array
{
    return array_filter([
        '[@click](https://github.com/click)' => "console.log('hi')",
        'data-name' => $this->name,
        'data-foo' => $this->name === 'foo' ? 'true' : null,
    ]);
}
<x-input :extra-attributes="$this->inputAttributes" />
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
jhaskell13/laraflow
sebastienheyd/boilerplate-media-manager
ccast/tagixo-primix
pretendtrue/laravel-builder
sawmainek/laravel-scout-tntsearch-driver
tomshaw/laravel-calendar-table
dibakar/laravel-ownership
steadrun/laravel-monitor
labyrinthe/connect-laravel
elmogy/layan
drewdan/sentinel-client
dskripchenko/laravel-llm
fatryst/nuonuo
stevenay/myanfont
gmostafa/php-graphql-client
xeviant/paystack
snowsoft/faker
meditationsteps/blogetc
animalyoung/laravel-influxdb
onix-solutions/sms-telera