file-input

A file field with an image thumbnail. The form needs the files option.

Example

Pick an image to see the thumbnail.

Laravel

<x-admin::file-input name="g_portrait" label="Portrait" accept="image/*" hint="Pick an image to see the thumbnail." />

Props

PropRequiredDefaultOptions
namenull
labelnull
hintnull
errornull
idnull
acceptnull
multiplefalse
currentnull
removablefalse
optionalfalse
requiredfalse

Other attributes, such as wire:model or data-*, pass through to the element.

Other stacks

React and Vue: import { FileInput } from "@admiral/ui-kit/react" (or /vue). See the React and Vue guide.

HTML, for any stack
<div class="adm-field">
            <label class="adm-label" for="g_portrait">Portrait</label>
        <div class="adm-file">
                    <img class="adm-file__preview" data-adm-file-preview alt=""  hidden >
                <input
            type="file"
             name="g_portrait"              id="g_portrait"              accept="image/*"                                                  aria-describedby="g_portrait-hint"             class="adm-file__input"
        >
    </div>
    <span class="adm-hint" id="g_portrait-hint">Pick an image to see the thumbnail.</span>    </div>