UNPKG

quasar

Version:

Build high-performance VueJS user interfaces (SPA, PWA, SSR, Mobile and Desktop) in record time

380 lines 10.4 kB
{ "type": "component", "meta": { "docsUrl": "https://v1.quasar.dev/vue-components/field" }, "props": { "error": { "type": "Boolean", "desc": "Does field have validation errors?", "category": "behavior" }, "error-message": { "type": "String", "desc": "Validation error message (gets displayed only if 'error' is set to 'true')", "examples": [ "Username must have at least 5 characters" ], "category": "content" }, "no-error-icon": { "type": "Boolean", "desc": "Hide error icon when there is an error", "category": "content" }, "rules": { "type": "Array", "desc": "Array of Functions/Strings; If String, then it must be a name of one of the embedded validation rules", "examples": [ ":rules=\"[ val => val.length <= 3 || 'Please use maximum 3 characters' ]\"", ":rules=\"[ 'fulltime' ]\"" ], "category": "behavior" }, "lazy-rules": { "type": "Boolean", "desc": "Check validation status against the 'rules' only after field loses focus for first time", "category": "behavior" }, "label": { "type": "String", "desc": "A text label that will “float” up above the input field, once the field gets focus", "examples": [ "Username" ], "category": "content" }, "stack-label": { "type": "Boolean", "desc": "Label will be always shown above the field regardless of field content (if any)", "category": "content" }, "hint": { "type": "String", "desc": "Helper (hint) text which gets placed below your wrapped form component", "examples": [ "Fill in between 3 and 12 characters" ], "category": "content" }, "hide-hint": { "type": "Boolean", "desc": "Hide the helper (hint) text when field doesn't have focus", "category": "content" }, "prefix": { "type": "String", "desc": "Prefix", "examples": [ "$" ], "category": "content" }, "suffix": { "type": "String", "desc": "Suffix", "examples": [ "@gmail.com" ], "category": "content" }, "color": { "type": "String", "desc": "Color name for component from the Quasar Color Palette", "examples": [ "primary", "teal-10" ], "category": "style" }, "bg-color": { "type": "String", "desc": "Color name for component from the Quasar Color Palette", "examples": [ "primary", "teal-10" ], "category": "style" }, "dark": { "type": "Boolean", "desc": "Notify the component that the background is a dark color", "category": "style" }, "loading": { "type": "Boolean", "desc": "Signals the user a process is in progress by displaying a spinner; Spinner can be customized by using the 'loading' slot.", "category": "behavior|content" }, "clearable": { "type": "Boolean", "desc": "Appends clearable icon when a value (not undefined or null) is set; When clicked, model becomes null", "category": "behavior|content" }, "clear-icon": { "type": "String", "desc": "Custom icon to use for the clear button when using along with 'clearable' prop", "examples": [ "close" ], "category": "content" }, "filled": { "type": "Boolean", "desc": "Use 'filled' design for the field", "category": "style" }, "outlined": { "type": "Boolean", "desc": "Use 'outlined' design for the field", "category": "style" }, "borderless": { "type": "Boolean", "desc": "Use 'borderless' design for the field", "category": "style" }, "standout": { "type": [ "Boolean", "String" ], "desc": "Use 'standout' design for the field; Specifies classes to be applied when focused (overriding default ones)", "examples": [ "standout", "standout=\"bg-primary text-white\"" ], "category": "style" }, "bottom-slots": { "type": "Boolean", "desc": "Enables bottom slots ('error', 'hint', 'counter')", "category": "content" }, "hide-bottom-space": { "type": "Boolean", "desc": "Does not reserves space for hint/error/counter anymore when these are not used; as a result, it also disables the animation for those", "category": "style" }, "counter": { "type": "Boolean", "desc": "Show an automatic counter on bottom right", "category": "content" }, "rounded": { "type": "Boolean", "desc": "Applies a small standard border-radius for a squared shape of the component", "category": "style" }, "square": { "type": "Boolean", "desc": "Remove border-radius so borders are squared; Overrides 'rounded' prop", "category": "style" }, "dense": { "type": "Boolean", "desc": "Dense mode; occupies less space", "category": "style" }, "items-aligned": { "type": "Boolean", "desc": "Align content to match QItem", "category": "content" }, "disable": { "type": "Boolean", "desc": "Put component in disabled mode", "category": "state" }, "readonly": { "type": "Boolean", "desc": "Put component in readonly mode", "category": "state" }, "autofocus": { "type": "Boolean", "desc": "Focus field on initial component render", "category": "behavior" }, "for": { "type": "String", "desc": "DOM element id to be used as 'for' attribute of the label and as 'id' for the focus target", "examples": [ "for=\"myFieldsId\"" ], "category": "behavior", "addedIn": "v1.4.2" }, "maxlength": { "type": [ "String", "Number" ], "desc": "Specify a max length of model", "examples": [ "12" ], "category": "model" }, "item-aligned": { "type": "Boolean", "desc": "Match inner content alignments to QItem", "category": "style" } }, "slots": { "default": { "desc": "Field main content" }, "prepend": { "desc": "Prepend inner field; Suggestions: QIcon, QBtn" }, "append": { "desc": "Append to inner field; Suggestions: QIcon, QBtn" }, "before": { "desc": "Prepend outer field; Suggestions: QIcon, QBtn" }, "after": { "desc": "Append outer field; Suggestions: QIcon, QBtn" }, "error": { "desc": "Slot for errors; Enabled only if 'bottom-slots' prop is used; Suggestion: <div>" }, "hint": { "desc": "Slot for hint text; Enabled only if 'bottom-slots' prop is used; Suggestion: <div>" }, "counter": { "desc": "Slot for counter text; Enabled only if 'bottom-slots' prop is used; Suggestion: <div>" }, "loading": { "desc": "Override default spinner when component is in loading mode; Use in conjunction with 'loading' prop" } }, "scopedSlots": { "control": { "desc": "Slot for controls; Suggestion QSlider, QRange, QKnob, ...", "scope": { "id": { "type": "String", "desc": "Element id used in the `for` attribute of the field label. Can be used to link the control to the label", "examples": [ "qf_363270c0-7a83-62b1-8dcf-6dfd64ee38fa" ] }, "field": { "type": "Object", "desc": "DOM element of the field" }, "editable": { "type": "Boolean", "desc": "Field is editable" }, "focused": { "type": "Boolean", "desc": "Field has focus" }, "floatingLabel": { "type": "Boolean", "desc": "Field's label is floating" }, "value": { "type": "Any", "desc": "Field's value", "examples": [ 0.241, "Text" ] }, "emitValue": { "type": "Function", "desc": "Function that emits an @input event in the context of the field", "params": { "value": { "type": "Any", "desc": "Value to be emitted", "examples": [ 0, "Changed text" ] } }, "returns": null } } } }, "events": { "clear": { "desc": "When using the 'clearable' property, this event is emitted when the clear icon is clicked", "addedIn": "v1.1.5", "params": { "value": { "type": [ "Any" ], "desc": "The previous value before clearing it" } } }, "input": { "desc": "Emitted when the model changes, only when used with 'clearable' or the 'control' scoped slot.", "params": { "value": { "type": "Any", "desc": "New model value", "required": true } } }, "focus": { "desc": "Emitted when component gets focused", "params": { "evt": { "type": "Object", "desc": "JS event object" } } }, "blur": { "desc": "Emitted when component loses focus", "params": { "evt": { "type": "Object", "desc": "JS event object" } } } }, "methods": { "resetValidation": { "desc": "Reset validation status" }, "validate": { "desc": "Trigger a validation", "params": { "value": { "type": "Any", "desc": "Optional value to validate against" } }, "returns": { "type": [ "Boolean", "Promise<boolean>" ], "desc": "True/false if no async rules, otherwise a Promise with the outcome (true -> validation was a success, false -> invalid models detected)", "examples": [ "true", "validate().then(outcome => { ... })" ] } }, "focus": { "desc": "Focus field" }, "blur": { "desc": "Blur field (lose focus)" } } }