Genie.Renderer.Html.select - Function
select(fieldname::Symbol, args...; options::Symbol, kwargs...)Examples
Model
julia> @vars SelectModel begin
model::R{Vector{String}} = []
networks::R{Vector{String}} = ["Google", "Facebook", "Twitter", "Pinterest", "Reddit"]
endView
julia> select(:model, options= :networks, useinput=true, multiple=true, clearable = true, filled = true, counter = true, usechips = true, label="Social Networks")Arguments
- Behaviour
name::String- Used to specify the name of the control; Useful if dealing with forms; If not specified, it takes the value of 'for' prop, if it exists ex.car-idcar-idvirtualscrollhorizontal::Bool- Make virtual list work in horizontal modeerror::Bool- Does field have validation errors?rules::Vector- Array of Functions/Strings; If String, then it must be a name of one of the embedded validation rulesrules="[ val => val.length <= 3 || 'Please use maximum 3 characters' ]"reactiverules::Bool- By default a change in the rules does not trigger a new validation until the model changes; If set to true then a change in the rules will trigger a validation; Has a performance penalty, so use it only when you really need itlazyrules::Union{Bool, String}- If set to boolean true then it checks validation status against the 'rules' only after field loses focus for first time; If set to 'ondemand' then it will trigger only when component's validate() method is manually called or when the wrapperformsubmits itself ex.(Boolean) true(Boolean) falseondemandloading::Bool- Signals the user a process is in progress by displaying a spinner; Spinner can be customized by using the 'loading' slot.clearable::Bool- Appends clearable icon when a value (not undefined or null) is set; When clicked, model becomes nullautofocus::Bool- Focus field on initial component renderfor::String- Used to specify the 'id' of the control and also the 'for' attribute of the label that wraps it; If no 'name' prop is specified, then it is used for this attribute as wellmyFieldsIdhidedropdownicon::Bool- Hide dropdown iconfillinput::Bool- Fills the input with current value; Useful along with 'hideselected'; Does NOT works along with 'multiple' selectionnewvaluemode::String- Enables creation of new values and defines behavior when a new value is added: 'add' means it adds the value (even if possible duplicate), 'add-unique' adds only unique values, and 'toggle' adds or removes the value (based on if it exists or not already); When using this prop then listening fornewvaluebecomes optional (only to override the behavior defined bynewvaluemode) ex.addadd-uniquetoggleautocomplete::String- Autocomplete attribute for field ex.autocomplete="country"transitionshow::String- Transition when showing the menu/dialog; One of embedded transitions ex.fadeslide-downtransitionhide::String- Transition when hiding the menu/dialog; One of embedded transitions ex.fadeslide-downbehavior::String- Overrides the default dynamic mode of showing as menu on desktop and dialog on mobilesdefaultmenudialog
- Content
tablecolspan::Union{Int, String}- The number of columns in the table (you need this if you use table-layout: fixed) ex.tablecolspan="12"errormessage::String- Validation error message (gets displayed only if 'error' is set to 'true') ex.Username must have at least 5 charactersnoerroricon::Bool- Hide error icon when there is an errorlabel::Union{String,Symbol}- A text label that will “float” up above the input field, once the field gets focus ex.Usernamestacklabel::Bool- Label will be always shown above the field regardless of field content (if any)hint::String- Helper (hint) text which gets placed below your wrapped form component ex.Fill in between 3 and 12 charactershidehint::Bool- Hide the helper (hint) text when field doesn't have focusprefix::String- Prefix ex.$suffix::String- Suffix ex.@gmail.comloading::Bool- Signals the user a process is in progress by displaying a spinner; Spinner can be customized by using the 'loading' slot.clearable::Bool- Appends clearable icon when a value (not undefined or null) is set; When clicked, model becomes nullclearicon::String- Custom icon to use for the clear button when using along with 'clearable' attribute ex.closelabelslot::Bool- Enables label slot; You need to set it to force use of the 'label' slot if the 'label' prop is not setbottomslots::Bool- Enables bottom slots ('error', 'hint', 'counter')counter::Bool- Show an automatic counter on bottom rightdropdownicon::String- Icon name; ; Make sure you have the icon library installed unless you are using 'img:' prefix; If 'none' (String) is used as value then no icon is rendered (but screen real estate will still be used for it) ex.mapion-addimg=https://cdn.quasar.dev/logo/svg/quasar-logo.svgimg=path/to/some_image.pnguseinput::Bool- Use an input tag where users can typeinputdebounce::Union{Int, String}- Debounce the input model update with an amount of milliseconds ex.500600
- General
tabindex::Union{Int, String}- Tabindex HTML attribute value ex.0100
- Model
multiple::Bool- Allow multiple selection; Model must be Arrayemitvalue::Bool- Update model with the value of the selected option instead of the whole option
- Options
options::Vector- Available options that the user can select from. For best performance freeze the list of options ex.options=[ 'BMW', 'Samsung Phone' ]optionvalue::String- Property of option which holds the 'value'; If using a function then for best performance, reference it from your scope and do not define it inline ex.optionvalue=modelNumberoptionvalue="(item) => item === null ? null : item.modelNumber"optionlabel::Union{String,Symbol}- Property of option which holds the 'label'; If using a function then for best performance, reference it from your scope and do not define it inline ex.optionlabel=itemNameoptionlabel="(item) => item === null ? null : item.itemName"optiondisable::String- Property of option which tells it's disabled; The value of the property must be a Boolean; If using a function then for best performance, reference it from your scope and do not define it inline ex.optiondisable=cannotSelectoptiondisable="(item) => item === null ? null : item.cannotSelect"optionsdense::Bool- Dense mode for options list; occupies less spaceoptionsdark::Bool- Options menu will be colored with a dark coloroptionsselectedclass::String- CSS class name for options that are active/selected; Set it to an empty string to stop applying the default (which is text-* where * is the 'color' prop value) ex.text-orangeoptionssanitize::Bool- Force use of textContent instead of innerHTML to render options; Use it when the options might be unsafe (from user input); Does NOT apply when using 'option' slot!optionscover::Bool- Expanded menu will cover the component (will not work along withuseinputattribute for obvious reasons)menushrink::Bool- Allow the options list to be narrower than the field (only in menu mode)mapoptions::Bool- Try to map labels of model fromoptionsVector; has a small performance penalty; If you are using emit-value you will probably need to use map-options to display the label text in the select field rather than the value; Refer to the 'Affecting model' section above
- Position
menuanchor::String- Two values setting the starting position or anchor point of the options list relative to the field (only in menu mode) ex.top lefttop middletop righttop starttop endcenter leftcenter middlecenter rightcenter startcenter endbottom leftbottom middlebottom rightbottom startbottom endmenuself::String- Two values setting the options list's own position relative to its target (only in menu mode) ex.top leftetcmenuoffset::Vector- An array of two numbers to offset the options list horizontally and vertically in pixels (only in menu mode) ex.[8, 8]
- Selection
multiple::Bool- Allow multiple selection; Model must be Arraydisplayvalue::Union{Int, String}- Override default selection string, if not usingselectedslot/scoped slot and if not usingusechipsattributedisplayvaluesanitize::Bool- Force use of textContent instead of innerHTML to render selected option(s); Use it when the selected option(s) might be unsafe (from user input); Does NOT apply when usingselectedorselecteditemslots!hideselected::Bool- Hides selection; Use the underlying input tag to hold the label (instead of showing it to the right of the input) of the selected option; Only works for nonmultipleSelectsmaxvalues::Union{Int, String}- Allow a maximum number of selections that the user can do ex.5usechips::Bool- Usechipcomponent to show what is currently selected
- State
disable::Bool- Put component in disabled modereadonly::Bool- Put component in readonly mode
- Style
labelcolor::String- Color name for the label from the Color Palette; Overrides thecolorprop; The difference fromcolorprop is that the label will always have this color, even when field is not focused ex.primaryteal-10color::String- Color name for component from the Color Palettebgcolor::String- Background color name for component from the Color Palettedark::Bool- Notify the component that the background is a dark colorfilled::Bool- Usefilleddesign for the fieldoutlined::Bool- Useoutlineddesign for the fieldborderless::Bool- Useborderlessdesign for the fieldstandout::Union{Bool, String}- Use 'standout' design for the field; Specifies classes to be applied when focused (overriding default ones) ex.standoutstandout="bg-primary text-white"hidebottomspace::Bool- Do not reserve space for hint/error/counter anymore when these are not used; As a result, it also disables the animation for those; It also allows the hint/error area to stretch vertically based on its contentrounded::Bool- Applies a small standard border-radius for a squared shape of the componentsquare::Bool- Remove border-radius so borders are squared; Overridesroundedprop/attributedense::Bool- Dense mode; occupies less spaceitemaligned::Bool- Match inner content alignment to that ofitemcomponentpopupcontentclass::String- Class definitions to be attributed to the popup content ex.my-special-classpopupcontentstyle::Union{Vector, String, Dict}- Style definitions to be attributed to the popup content ex.background-color: #ff0000popupcontentstyle!="{ backgroundColor: '#ff0000' }"inputclass::Union{Vector, String, Dict}- Class definitions to be attributed to the underlying input tag ex.my-special-classinputclass!="{ 'my-special-class': <condition> }"inputstyle::Union{Vector, String, Dict}- Style definitions to be attributed to the underlying input tag ex.background-color: #ff0000inputstyle!="{ backgroundColor: '#ff0000' }"
- Virtual-scroll
virtualscrollslicesize::Union{Int, String}- Minimum number of items to render in the virtual list ex.virtualscrollslicesize="60"30virtualscrollsliceratiobefore::Union{Int, String}- Ratio of number of items in visible zone to render before it ex.virtualscrollsliceratiobefore="30"30virtualscrollsliceratioafter::Union{Int, String}- Ratio of number of items in visible zone to render after it ex.virtualscrollsliceratioafter="0.3"virtualscrollitemsize::Union{Int, String}- Default size in pixels (height if vertical, width if horizontal) of an item; This value is used for rendering the initial list; Try to use a value close to the minimum size of an item ex.virtualscrollitemsize="48"virtualscrollstickysizestart::Union{Int, String}- Size in pixels (height if vertical, width if horizontal) of the sticky part (if using one) at the start of the list; A correct value will improve scroll precision ex.0virtualscrollstickysizestart="23virtualscrollstickysizeend::Union{Int, String}- Size in pixels (height if vertical, width if horizontal) of the sticky part (if using one) at the end of the list; A correct value will improve scroll precision ex.0tablecolspan::Union{Int, String}- The number of columns in the table (you need this if you use table-layout: fixed) ex.tablecolspan="3"