Skip to content

InlineInput

InlineInput

Wrap over the inline-input elements.

jsx
import InlineInput from 'intergalactic/inline-input';
<InlineInput />;
import InlineInput from 'intergalactic/inline-input';
<InlineInput />;

InlineInputProps

& {...}
NameTypeDescription
state"normal" | "valid" | "invalid" Visual state of inline input
loadingboolean Disabled input and shows spinner instead of confirm control
disabledboolean Disabled input and controls
onConfirm(value: string, event: React.MouseEvent | React.FocusEvent | React.KeyboardEvent) => void Fired with entered value when user clicks confirm control or hits `Enter` or `Space`
onCancel(prevValue: string, event: React.MouseEvent | React.FocusEvent | React.KeyboardEvent) => void Fired with value (or defaultValue) that was provided during component mount when user clicks cancel control or hits `Escape`
valuestring Text value of input. Should be used with `onChange` property together
defaultValuestring Initial text value of input
autoFocusboolean Makes component to catch browser focus on component mount
placeholderstring Gray text displayed in empty input
onBlurBehavior"cancel" | "confirm" | "none" defines callback (`onCancel` or `onConfirm`) triggered when `blur` event out of container fired Triggered after all previous macrotasks completed (internally called inside of `setTimeout`)
localestring

InlineInput.Value

This component represents the native tag input and accepts all its properties, such as value and onChange.

jsx
import InlineInput from 'intergalactic/inline-input';
<InlineInput.Value />;
import InlineInput from 'intergalactic/inline-input';
<InlineInput.Value />;

InlineInputValueProps

& {...}
NameTypeDescription
idstring id attribute of input tag
autoFocusboolean when `true`, element is focused immediately after mount
valuestring value of input tag
defaultValuestring uncontrolled value of input tag
onChange(value: string, event: React.ChangeEvent) => void callback invoked on every change of input tag value
state"normal" | "valid" | "invalid" visual state of component
loadingboolean shows spinner in `InlineInput.ConfirmControl` and disables other interactive elements
disabledboolean disables interactive elements
placeholderstring gray text in empty input tag

InlineInput.Addon

The addon inside the container (most often it is an icon or short text) places the correct indent units depending on the size.

When you click on Addon, the focus shifts to the input. You can cancel this by returning the return false in the onClick handler.

jsx
import InlineInput from 'intergalactic/inline-input';
<InlineInput.Addon />;
import InlineInput from 'intergalactic/inline-input';
<InlineInput.Addon />;

InlineInput.ConfirmControl

The addon with hint tooltip and icon. By default is displayed with middle-size Check icon. Addon click triggers InlineInput onConfirm callback.

When loading property is provided to InlineInput, InlineInput.ConfirmControl icon replaced with spinner.

jsx
import InlineInput from 'intergalactic/inline-input';
<InlineInput.ConfirmControl />;
import InlineInput from 'intergalactic/inline-input';
<InlineInput.ConfirmControl />;

InlineInputConfirmControlProps

& {...}
NameTypeDescription
titlestring Text of tooltip
iconReact.FC Icon component

InlineInput.CancelControl

The addon with hint tooltip and icon. By default is displayed with middle-size Close icon. Addon click triggers InlineInput onCancel callback.

jsx
import InlineInput from 'intergalactic/inline-input';
<InlineInput.CancelControl />;
import InlineInput from 'intergalactic/inline-input';
<InlineInput.CancelControl />;

InlineInputCancelControlProps

& {...}
NameTypeDescription
titlestring Text of tooltip
iconReact.FC Icon component

Released under the MIT License.

Released under the MIT License.