Skip to main content

Input

The input component is SfInput. This building block can be used to accept various types of user inputs.

InputType

Types of inputs supported are as follows:

InputTypeDescription
nameinput field for accepting names
emailinput field for accepting emails
mobileinput field for accepting mobiles
genderinput field for accepting gender
dateinput field for accepting date
dateOfBirthinput field for accepting date of birth

Features

SfInput also has some additional in-built features.

  • Built-in Validations - validation of user input happens according to the inputType as the user types
  • Enter Press Handling - onEnterPressed callback can be used to detect when the user presses the enter key
  • Day / Night Mode - in-built support for day mode and night mode, set using a prop

Usage

Imports

import {SfInput} from 'react-sf-building-blocks'

Usage

Result
Loading...
Live Editor

Variants

Result
Loading...
Live Editor

Disabled

Result
Loading...
Live Editor

Icon

import {CardHeading, EnvelopeFill, PhoneFill, CalendarEventFill} from 'react-bootstrap-icons';
Result
Loading...
Live Editor

Hint

Result
Loading...
Live Editor

Pre-fill Value

Result
Loading...
Live Editor

Day / Night Mode

Result
Loading...
Live Editor

Props

PropTypeMandatoryDescription
variantstringyestheme variant such as primary, secondary, danger, etc.
captionstringyesbutton text
inputTypestringyestype of input - "name"
onCompletecallbackyescallback function when correct input is inserted
valuestringnovalue to pre-fill the inputwith
onEnterPressedcallbacknocallback function when user presses enter key
hintstringnoplaceholder value
disabledbooleannoflag to disable the button
autoFocusbooleannoflag, which sets autofocus on load
modestringno"day" / "night"
themeobjectnosuperflows theme object
iconobjectnobootstrap icon to be shown after the text
classNameContainerstringnoany classes that need to passed to the container
classNameInputstringnoany classes that need to passed to the inputs
stylesContainerstringnoany styles that need to passed to the container
stylesInputstringnoany styles that need to passed to the inputs