Input
The Bootstrap input form component, implemented in Ruby. Use it like any of the other matestack form components in your apps, pages and components. It offers customizable options to simply achieve what is possible in Bootstrap with this component. See below for more information about the configuration options.
bs_form_input(*args, &block)
bs_form_input(*args, &block)Renders a Bootstrap input field.
Optional options
type- Defaults to:text, can be set to:rangeor:filelabel- Expects a string, gets displayed before the select menuform_text- Expects a string, gets displayed after the select menudisabled- If set to:true, the input field is set to disabled and clicking them doesn't yield any effectbrowse_button_text- Expects a string and sets the text to be displayed in the "browse" button for the:fileinputplaceholder- Expects a string to be displayed as a placeholder for whatever the user decides to choose for the:fileinput. Defaults to "Choose file"variant- Expects a symbol to change the size of the select menu, you can use either:smor:lgmin- Sets the corresponding HTML attributemax- Sets the corresponding HTML attributestep- Sets the corresponding HTML attributeshow_value- Expects a boolean. Defaults tofalse, if set totrueit displays the current value for the corresponding:rangeinput type field
Examples
Basic usage for text input
bs_form_input key: :foo, type: :textBasic usage for float number input
bs_form_input key: :foo, type: :number, step: 0.01Basic usage with label and form text
bs_form_input key: :foo, type: :text, label: "Input field", form_text: "some notes"Basic usage as disabled input
bs_form_input key: :foo, type: :text, disabled: truereturns
Basic usage with custom class
bs_form_input key: :foo, type: :text, class: "some-class"Basic usage with placeholder
bs_form_input key: :foo, type: :text, placeholder: "fill!"Basic usage as range input
bs_form_input key: :some_range_input, type: :range, max: 10Using range input with show_value and non-default steps
bs_form_input key: :some_range_input, type: :range, step: 2, max: 10, show_value: trueBasic usage as file input
bs_form_input key: :some_single_file_input, type: :fileFile input with non-default size and optional form_text
bs_form_input variant: :lg, form_text: "just some notes", key: :some_single_file_input, type: :fileMulti-file input with placeholder and browse_button_text
bs_form_input placeholder: "Select a file", browse_button_text: "Click", key: :some_multi_file_input, type: :file, multiple: trueLast updated