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.
ltrrtlSet the draggable attribute. An enumerated attribute that indicates whether the element can be dragged, using the HTML Drag and Drop API.
autofalsetrueSet the dropzone attribute. An enumerated attribute indicating what types of content can be dropped on an element, using the Drag and Drop API.
copymovelinkSet 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.
abaaafsqamaranhyasayazbaeubndzbhbibrbgmybekmcazhcohrcsdanleneoetfofafifrfyglgdgvkadeelklgnguhthahehihuisioidiaieiuikgaitjajvknkskkrwkyrnkokulolalvlilnltmkmgmsmlmtmimrmomnnanenoocorompsplptpaqurmroruszsmsgsasrshsttnsniisdsissskslsoessuswsvtltgtatttethbotitotstrtktwugukuruzvivowacywoxhyiyozuSet the role attribute.
alertalertdialogarticleapplicationbannerbuttoncheckboxcolumnheadercomboboxcomplementarycontentinfodefinitiondirectorydialogdocumentformgridgridcellgroupheadingimglinklistlistboxlistitemlogmainmarqueemathmenumenubarmenuitemmenuitemcheckboxmenuitemradionavigationnoteoptionpresentationprogressbarradioradiogroupregionrowrowgrouprowheaderscrollbarsearchseparatorsliderspinbuttonstatustabtablisttabpaneltextboxtimertoolbartooltiptreetreegridtreeitemSet 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.
truefalseSet the aria-busy boolean attribute.
Set the aria-controls attribute.
Set the aria-describedby attribute.
Set the aria-disabled attribute.
truefalseSet the aria-dropeffect attribute.
copymovelinkexecutepopupnoneSet the aria-flowto attribute.
Set the aria-grabbed attribute.
truefalseundefinedSet the aria-haspopup boolean attribute.
truefalseSet the aria-hidden boolean attribute.
truefalseSet the aria-invalid attribute.
grammarfalsespellingtrueSet the aria-label attribute.
Set the aria-labelledby attribute.
Set the aria-live attribute.
offpoliteassertiveSet the aria-owns attribute.
Set the aria-relevant attribute.
additionsremovalstextalladditions textMany 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-urlencodedmultipart/form-datatext/plainSet the formmethod attribute.
getpostSet the formnovalidate flag.
Set the formtarget attribute.
_blank_parent_self_topSet the name attribute.
Set the type attribute.
buttonresetsubmitSet 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-nameaddress-level1address-level2address-level3address-level4address-line1address-line2address-line3bdaybday-yearbday-daybday-monthbillingcc-additional-namecc-csccc-expcc-exp-monthcc-exp-yearcc-family-namecc-given-namecc-namecc-numbercc-typecountrycountry-namecurrent-passwordemailfamily-namefaxgiven-namehomehonorific-prefixhonorific-suffiximpplanguagemobilenamenew-passwordnicknameoffonorganizationorganization-titlepagerphotopostal-codesexshippingstreet-addresstel-area-codeteltel-country-codetel-extensiontel-localtel-local-prefixtel-local-suffixtel-nationaltransaction-amounttransaction-currencyurlusernameworkSet the enctype attribute.
application/x-www-form-urlencodedmultipart/form-datatext/plainSet the method attribute.
getpostSet the name attribute.
Set the novalidate flag.
Set the target attribute.
_blank_parent_self_topSet the accept attribute.
text/htmltext/plainapplication/mswordapplication/msexcelapplication/postscriptapplication/x-zip-compressedapplication/pdfapplication/rtfvideo/x-msvideovideo/quicktimevideo/x-mpeg2audio/x-pn/realaudioaudio/x-mpegaudio/x-wawaudio/x-aiffaudio/basicimage/tiffimage/jpegimage/gifimage/x-pngimage/x-photo-cdimage/x-MS-bmpimage/x-rgbimage/x-portable-pixmapimage/x-portable-greymapimage/x-portablebitmapSet the alt attribute.
Set the autocomplete attribute.
additional-nameaddress-level1address-level2address-level3address-level4address-line1address-line2address-line3bdaybday-yearbday-daybday-monthbillingcc-additional-namecc-csccc-expcc-exp-monthcc-exp-yearcc-family-namecc-given-namecc-namecc-numbercc-typecountrycountry-namecurrent-passwordemailfamily-namefaxgiven-namehomehonorific-prefixhonorific-suffiximpplanguagemobilenamenew-passwordnicknameoffonorganizationorganization-titlepagerphotopostal-codesexshippingstreet-addresstel-area-codeteltel-country-codetel-extensiontel-localtel-local-prefixtel-local-suffixtel-nationaltransaction-amounttransaction-currencyurlusernameworkSet 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-urlencodedmultipart/form-datatext/plainSet the formmethod attribute.
getpostSet the formnovalidate flag.
Set the formtarget attribute.
_blank_parent_self_topSet 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.
buttoncheckboxcolordatedatetimedatetime-localemailfilehiddenimagemonthnumberpasswordradiorangeresetsearchsubmitteltexttimeurlweekSet 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.
hardsoft