Aire’s core element APIs are auto-generated from the Atom Autocomplete package, which in turn sources data from MDN and Adobe Brackets. This means that all web standards-compliant HTML attributes are built-in with named methods.
Nearly all Aire attribute methods are fluent—they return the element instance to allow for chaining. For example:
{{ Aire::input()->label('Demo Input')->id('demo') }}
If you're using Tailwind, you're going to want an easy way to adjust the class names
applied to a given form element. Aire makes this easy, with addClass()
and removeClass()
. These are usually all you need to apply small adjustments
on a case-by-case basis.
Most form elements can have a value
. This value will automatically get
set via data binding or using the old form input if there was an error. If you want
to explicitly override the value, use the value($value)
method. If, instead,
you just want to set a value to use if no bound/old value is available, use
the defaultValue($value)
method (or defaultChecked()
for checkboxes).
If you need to add special data-
attributes to your elements,
use the data($key, $value)
method. If you pass NULL
as the value, the data attribute will be unset. If you pass an array or an
object that implements on of: Jsonable
, JsonSerializable
,
or Arrayable
, that value will automatically be JSON-encoded for
you (useful for passing data to javascript).
If you want to set your own arbitrary attributes on an element (say,
wire:click
),
you can use the setAttribute($key, $value)
method, which will set
whatever attribute you choose regardless of whether it's valid HTML.
There are some attributes that are global to all HTML elements. Each of these are documented
in Galahad\Aire\DTD\Concerns\HasGlobalAttributes
. These are:
Set the accesskey
attribute. Provides a hint for generating a keyboard shortcut for the current element.
Set the contenteditable
boolean attribute. An enumerated attribute indicating if the element should be editable by the user.
Set the contextmenu
attribute. The id of a menu to use as the contextual menu for this element.
Set the dir
attribute. An enumerated attribute indicates the directionality of the element's text.
ltr
rtl
Set the draggable
attribute. An enumerated attribute that indicates whether the element can be dragged, using the HTML Drag and Drop API.
auto
false
true
Set the dropzone
attribute. An enumerated attribute indicating what types of content can be dropped on an element, using the Drag and Drop API.
copy
move
link
Set the hidden
flag. A Boolean attribute indicating that the element is not yet, or is no longer, relevant.
Set the id
attribute. Defines a unique identifier (ID) which must be unique in the whole document.
Set the lang
attribute. Participates in defining the language of the element, the language that its non-editable elements are written in or the language that the editable elements should be written in.
ab
aa
af
sq
am
ar
an
hy
as
ay
az
ba
eu
bn
dz
bh
bi
br
bg
my
be
km
ca
zh
co
hr
cs
da
nl
en
eo
et
fo
fa
fi
fr
fy
gl
gd
gv
ka
de
el
kl
gn
gu
ht
ha
he
hi
hu
is
io
id
ia
ie
iu
ik
ga
it
ja
jv
kn
ks
kk
rw
ky
rn
ko
ku
lo
la
lv
li
ln
lt
mk
mg
ms
ml
mt
mi
mr
mo
mn
na
ne
no
oc
or
om
ps
pl
pt
pa
qu
rm
ro
ru
sz
sm
sg
sa
sr
sh
st
tn
sn
ii
sd
si
ss
sk
sl
so
es
su
sw
sv
tl
tg
ta
tt
te
th
bo
ti
to
ts
tr
tk
tw
ug
uk
ur
uz
vi
vo
wa
cy
wo
xh
yi
yo
zu
Set the role
attribute.
alert
alertdialog
article
application
banner
button
checkbox
columnheader
combobox
complementary
contentinfo
definition
directory
dialog
document
form
grid
gridcell
group
heading
img
link
list
listbox
listitem
log
main
marquee
math
menu
menubar
menuitem
menuitemcheckbox
menuitemradio
navigation
note
option
presentation
progressbar
radio
radiogroup
region
row
rowgroup
rowheader
scrollbar
search
separator
slider
spinbutton
status
tab
tablist
tabpanel
textbox
timer
toolbar
tooltip
tree
treegrid
treeitem
Set the spellcheck
boolean attribute. An enumerated attribute defines whether the element may be checked for spelling errors.
Set the style
attribute. Contains CSS styling declarations to be applied to the element.
Set the tabindex
attribute. Indicates if its element can be focused, and if/where it participates in sequential keyboard navigation (usually with the Tab key, hence the name).
Set the title
attribute. Contains text representing advisory information, related to the element it belongs to.
Set the aria-activedescendant
attribute.
Set the aria-atomic
boolean attribute.
true
false
Set the aria-busy
boolean attribute.
Set the aria-controls
attribute.
Set the aria-describedby
attribute.
Set the aria-disabled
attribute.
true
false
Set the aria-dropeffect
attribute.
copy
move
link
execute
popup
none
Set the aria-flowto
attribute.
Set the aria-grabbed
attribute.
true
false
undefined
Set the aria-haspopup
boolean attribute.
true
false
Set the aria-hidden
boolean attribute.
true
false
Set the aria-invalid
attribute.
grammar
false
spelling
true
Set the aria-label
attribute.
Set the aria-labelledby
attribute.
Set the aria-live
attribute.
off
polite
assertive
Set the aria-owns
attribute.
Set the aria-relevant
attribute.
additions
removals
text
all
additions text
Many elements have their own set of attributes. These include:
Set the autofocus
flag.
Set the disabled
flag.
Set the form
attribute.
Set the formaction
attribute.
Set the formenctype
attribute.
application/x-www-form-urlencoded
multipart/form-data
text/plain
Set the formmethod
attribute.
get
post
Set the formnovalidate
flag.
Set the formtarget
attribute.
_blank
_parent
_self
_top
Set the name
attribute.
Set the type
attribute.
button
reset
submit
Set the value
attribute.
Set the disabled
flag.
Set the form
attribute.
Set the name
attribute.
Set the accept-charset
attribute.
Set the action
attribute.
Set the autocomplete
attribute.
additional-name
address-level1
address-level2
address-level3
address-level4
address-line1
address-line2
address-line3
bday
bday-year
bday-day
bday-month
billing
cc-additional-name
cc-csc
cc-exp
cc-exp-month
cc-exp-year
cc-family-name
cc-given-name
cc-name
cc-number
cc-type
country
country-name
current-password
email
family-name
fax
given-name
home
honorific-prefix
honorific-suffix
impp
language
mobile
name
new-password
nickname
off
on
organization
organization-title
pager
photo
postal-code
sex
shipping
street-address
tel-area-code
tel
tel-country-code
tel-extension
tel-local
tel-local-prefix
tel-local-suffix
tel-national
transaction-amount
transaction-currency
url
username
work
Set the enctype
attribute.
application/x-www-form-urlencoded
multipart/form-data
text/plain
Set the method
attribute.
get
post
Set the name
attribute.
Set the novalidate
flag.
Set the target
attribute.
_blank
_parent
_self
_top
Set the accept
attribute.
text/html
text/plain
application/msword
application/msexcel
application/postscript
application/x-zip-compressed
application/pdf
application/rtf
video/x-msvideo
video/quicktime
video/x-mpeg2
audio/x-pn/realaudio
audio/x-mpeg
audio/x-waw
audio/x-aiff
audio/basic
image/tiff
image/jpeg
image/gif
image/x-png
image/x-photo-cd
image/x-MS-bmp
image/x-rgb
image/x-portable-pixmap
image/x-portable-greymap
image/x-portablebitmap
Set the alt
attribute.
Set the autocomplete
attribute.
additional-name
address-level1
address-level2
address-level3
address-level4
address-line1
address-line2
address-line3
bday
bday-year
bday-day
bday-month
billing
cc-additional-name
cc-csc
cc-exp
cc-exp-month
cc-exp-year
cc-family-name
cc-given-name
cc-name
cc-number
cc-type
country
country-name
current-password
email
family-name
fax
given-name
home
honorific-prefix
honorific-suffix
impp
language
mobile
name
new-password
nickname
off
on
organization
organization-title
pager
photo
postal-code
sex
shipping
street-address
tel-area-code
tel
tel-country-code
tel-extension
tel-local
tel-local-prefix
tel-local-suffix
tel-national
transaction-amount
transaction-currency
url
username
work
Set the autofocus
flag.
Set the checked
flag.
Set the dirname
attribute.
Set the disabled
flag.
Set the form
attribute.
Set the formaction
attribute.
Set the formenctype
attribute.
application/x-www-form-urlencoded
multipart/form-data
text/plain
Set the formmethod
attribute.
get
post
Set the formnovalidate
flag.
Set the formtarget
attribute.
_blank
_parent
_self
_top
Set the height
attribute.
Set the list
attribute.
Set the max
attribute.
Set the maxlength
attribute.
Set the min
attribute.
Set the multiple
flag.
Set the name
attribute.
Set the pattern
attribute.
Set the placeholder
attribute.
Set the readonly
flag.
Set the required
flag.
Set the size
attribute.
Set the src
attribute.
Set the step
attribute.
Set the type
attribute.
button
checkbox
color
date
datetime
datetime-local
email
file
hidden
image
month
number
password
radio
range
reset
search
submit
tel
text
time
url
week
Set the value
attribute.
Set the width
attribute.
Set the for
attribute.
Set the form
attribute.
Set the disabled
flag.
Set the label
attribute.
Set the selected
flag.
Set the value
attribute.
Set the autofocus
flag.
Set the disabled
flag.
Set the form
attribute.
Set the multiple
flag.
Set the name
attribute.
Set the required
flag.
Set the size
attribute.
Set the autofocus
flag.
Set the cols
attribute.
Set the dirname
attribute.
Set the disabled
flag.
Set the form
attribute.
Set the label
attribute.
Set the maxlength
attribute.
Set the name
attribute.
Set the placeholder
attribute.
Set the readonly
flag.
Set the required
flag.
Set the rows
attribute.
Set the wrap
attribute.
hard
soft