Flowbite::Input
The individual input form element used in forms - without labels, error messages, hints, etc.
Use this when you want to render an input field on its own without any surrounding elements, i.e. as a building block in more complex input components. To render a complete input field with labels and error messages, use Flowbite::InputField instead.
By default this renders a text input field. To render other types of input fields, use one of the subclasses, such as Flowbite::Input::Checkbox or Flowbite::Input::Textarea.
Usage
<%= render(Flowbite::Input::Email.new(attribute: :email, form: form)) %>
Examples
Types
Inputs come in various types such as text, email, password, number, URL, and phone number.
Sizes
Use the following examples to apply a small, default or large size for the input fields.
Disabled State
Input With Placeholder
API reference
Flowbite
In namespace
Constructor
def initialize(attribute:, form:, class: nil, disabled: false, options: {}, size: :default)
Parameters
attribute |
Symbol | The attribute on the form's object this input field is for. |
|---|---|---|
form |
ActionView::Helpers::FormBuilder | The form builder this input field is part of. |
class |
String, Array<String> | Additional CSS classes to apply to the input field. |
disabled |
Boolean | Whether the input field should be disabled. |
options |
Hash | Additional HTML attributes to pass to the input field. For example, you can use this to set placeholder text by passing +options: {placeholder: "Enter your name"}+ |
size |
Symbol | The size of the input field. Can be one of +:sm+, +:default+, or +:lg+. |
See also
Ruby API documentation forclass Flowbite::Input