menu
0.11.5
Keyboard experimental
A responsive on-screen keyboard control component.
Module
import '@capitec/omni-components/keyboard';
content_copy
import { OmniKeyboard } from "@capitec/omni-components-react/keyboard";
content_copy
Interactive
Attach By Attribute
Attach By Id
Enter Key Hint Variations
Masked Values
Hide Display Value
Hide Keyboard
Alternate Modes
Slotted Content
Via Script
Vanilla Inputs

Properties

Name Attribute Type Description
attachMode attach-mode 
'all' | 'attribute' | 'id'
The rule for the Keyboard to attach to inputs for showing on component focus.
all - The Keyboard will show on focus for all input related components unless opted out with data-omni-keyboard-hidden on the component.
attribute - The Keyboard will only show on focus for input related components with the data-omni-keyboard-attach attribute
id - The Keyboard will only show on focus for input related components with the data-omni-keyboard-attach attribute set equal to the Keyboard's id
closeLabel close-label 
string
The text label to display by the close button.
spaceLabel space-label 
string
The text label to display on the spacebar button.
clearLabel clear-label 
string
The text label to display on the clear button. The clear slot takes precedence over this label.
actionLabel action-label 
string
The text label to display on the call to action button when enterkeyhint is not defined or enterkeyhint="enter". The action-enter slot takes precedence over this label.
dir dir 
string
Used to set the base direction of text for display
lang lang 
string
Used to identify the language of text content on the web

Static Functions

Name Parameters Returns Description
create
init - KeyboardInit
Keyboard | undefined
Creates a new Keyboard element with the provided context and appends it to the DOM (either to document body or to provided target parent element).

Supported Global Attributes

Attribute Type Description
 data-omni-keyboard-attach
boolean | string
Indicates that the Keyboard is enabled for that component when the Keyboard has attach-mode="attribute" or when the value is equal to the Keyboard's id and attach-mode="id".
 data-omni-keyboard-hidden
boolean
Disables the Keyboard for that component.
 data-omni-keyboard-mode
InputMode
Indicates that the Keyboard is to render in specified type of inputmode. Takes precedence over inputmode attribute.
 enterkeyhint
EnterKeyHint
Indicates that the Keyboard's call to action button must render (and in some cases behave) accordingly.
 data-omni-keyboard-multi-line
boolean
Indicates that the call to action button inserts a new line instead of default behaviour.
 data-omni-keyboard-mask
boolean
Indicates that the Keyboard display value must be masked.
 data-omni-keyboard-no-display
boolean
Disables the Keyboard display value. Takes precedence over data-omni-keyboard-mask.

Types

Name Type
InputMode
'text' | 'decimal' | 'numeric' | 'tel' | 'search' | 'email' | 'url'
InputEventTypes
| 'insertText'
    | 'insertReplacementText'
    | 'insertLineBreak'
    | 'insertParagraph'
    | 'insertOrderedList'
    | 'insertUnorderedList'
    | 'insertHorizontalRule'
    | 'insertFromYank'
    | 'insertFromDrop'
    | 'insertFromPaste'
    | 'insertFromPasteAsQuotation'
    | 'insertTranspose'
    | 'insertCompositionText'
    | 'insertLink'
    | 'deleteWordBackward'
    | 'deleteWordForward'
    | 'deleteSoftLineBackward'
    | 'deleteSoftLineForward'
    | 'deleteEntireSoftLine'
    | 'deleteHardLineBackward'
    | 'deleteHardLineForward'
    | 'deleteByDrag'
    | 'deleteByCut'
    | 'deleteContent'
    | 'deleteContentBackward'
    | 'deleteContentForward'
    | 'historyUndo'
    | 'historyRedo'
    | 'formatBold'
    | 'formatItalic'
    | 'formatUnderline'
    | 'formatStrikeThrough'
    | 'formatSuperscript'
    | 'formatSubscript'
    | 'formatJustifyFull'
    | 'formatJustifyCenter'
    | 'formatJustifyRight'
    | 'formatJustifyLeft'
    | 'formatIndent'
    | 'formatOutdent'
    | 'formatRemove'
    | 'formatSetBlockTextDirection'
    | 'formatSetInlineTextDirection'
    | 'formatBackColor'
    | 'formatFontColor'
    | 'formatFontName'
EnterKeyHint
'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send' | undefined
KeyboardMode
'numeric' | 'alpha-numeric' | 'none'
InputEventInitWithType
| InputEventInit
    | {
          inputType: InputEventTypes;
      }
KeyboardInit
{
    /**
     * The id to apply to the Keyboard elements.
     */
    id?: string;

    /**
     * The container to append the Keyboard as child. If not provided will append to a new div element on the document body.
     */
    parent?: string | HTMLElement | DocumentFragment | null;

    /**
     * The rule for the Keyboard to attach to inputs for showing on component focus.
     * * `all` - The Keyboard will show on focus for all input related components unless opted out with `data-omni-keyboard-hidden` on the component.
     * * `attribute` - The Keyboard will only show on focus for input related components with the `data-omni-keyboard-attach` attribute.
     * * `id` - The Keyboard will only show on focus for input related components with the `data-omni-keyboard-attach` attribute set equal to the Keyboard's id
     */
    attachMode?: 'all' | 'attribute' | 'id';

    /**
     * The text label to display by the close button.
     */
    closeLabel?: string;

    /**
     * The text label to display on the spacebar button.
     */
    spaceLabel?: string;

    /**
     * The text label to display on the clear button. The `clear` slot takes precedence over this label.
     */
    clearLabel?: string;

    /**
     * The text label to display on the call to action button when `enterkeyhint` is not defined or `enterkeyhint="enter"`. The `action-enter` slot takes precedence over this label.
     */
    actionLabel?: string;

    /**
     * A function that returns content to render within the 'clear' slot
     */
    clear?: RenderFunction;

    /**
     * A function that returns content to render within the 'caps-off' slot
     */
    capsOff?: RenderFunction;

    /**
     * A function that returns content to render within the 'caps-on' slot
     */
    capsOn?: RenderFunction;

    /**
     * A function that returns content to render within the 'caps-lock' slot
     */
    capsLock?: RenderFunction;

    /**
     * A function that returns content to render within the 'backspace' slot
     */
    backspace?: RenderFunction;

    /**
     * A function that returns content to render within the 'close' slot
     */
    close?: RenderFunction;

    /**
     * A function that returns content to render within the 'action-enter' slot
     */
    actionEnter?: RenderFunction;

    /**
     * A function that returns content to render within the 'action-done' slot
     */
    actionDone?: RenderFunction;

    /**
     * A function that returns content to render within the 'action-go' slot
     */
    actionGo?: RenderFunction;

    /**
     * A function that returns content to render within the 'action-next' slot
     */
    actionNext?: RenderFunction;

    /**
     * A function that returns content to render within the 'action-previous' slot
     */
    actionPrevious?: RenderFunction;

    /**
     * A function that returns content to render within the 'action-search' slot
     */
    actionSearch?: RenderFunction;

    /**
     * A function that returns content to render within the 'action-send' slot
     */
    actionSend?: RenderFunction;
}

Slots

Name Description
loading_indicator
Used to define content that is displayed while async rendering is awaiting, or when renderLoading() is implicitly called
caps-off
Content to display on case change button when in a lowercase state.
caps-on
Content to display on case change button when in a single uppercase state.
caps-lock
Content to display on case change button when in a permanent uppercase state (caps lock).
close
Content to display next to close label.
backspace
Content to display on backspace button.
clear
Content to display on clear button.
action-done
Content to display on call to action button ('Enter') when target component has enterkeyhint="done".
action-go
Content to display on call to action button ('Enter') when target component has enterkeyhint="go".
action-next
Content to display on call to action button ('Enter') when target component has enterkeyhint="next".
action-previous
Content to display on call to action button ('Enter') when target component has enterkeyhint="previous".
action-search
Content to display on call to action button ('Enter') when target component has enterkeyhint="search".
action-send
Content to display on call to action button ('Enter') when target component has enterkeyhint="send".
action-enter
Content to display on call to action button ('Enter') when target component has enterkeyhint="enter" or enterkeyhint is not set.

Theme Variables

Name Description
--omni-theme-primary-color
Theme primary color.
--omni-theme-primary-hover-color
Theme primary hover color.
--omni-theme-primary-active-color
Theme primary active color.
--omni-theme-accent-color
Theme accent color.
--omni-theme-accent-hover-color
Theme accent hover color.
--omni-theme-accent-active-color
Theme accent active color.
--omni-theme-background-color
Theme background color.
--omni-theme-background-hover-color
Theme background hover color.
--omni-theme-background-active-color
Theme background active color.
--omni-theme-font-color
Theme font color.
--omni-theme-disabled-border-color
Theme disabled border color.
--omni-theme-disabled-background-color
Theme disabled background color.
--omni-theme-error-font-color
Theme disabled background color.
--omni-theme-error-border-color
Theme error border color.
--omni-theme-hint-font-color
Theme hint font color.
--omni-theme-inactive-color
Theme inactive color.
--omni-theme-box-shadow-color
Theme inactive color.
--omni-theme-font-family
Theme font family.
--omni-theme-font-size
Theme font size.
--omni-theme-font-weight
Theme font weight.
--omni-theme-border-radius
Theme border radius.
--omni-theme-border-width
Theme border width.
--omni-theme-box-shadow
Theme box shadow.

Component Variables

Name Description
--omni-keyboard-button-icon-max-height
Max height for slotted content in keyboard buttons.
--omni-keyboard-button-icon-max-width
Max width for slotted content in keyboard buttons.
--omni-keyboard-button-font-family
Font family for text in keyboard buttons.
--omni-keyboard-button-font-color
Font color for text in keyboard buttons.
--omni-keyboard-button-font-size
Font size for text in keyboard buttons.
--omni-keyboard-button-background-color
Background color for keyboard buttons.
--omni-keyboard-button-border
Border for keyboard buttons.
--omni-keyboard-button-margin
Margin for keyboard buttons.
--omni-keyboard-button-font-weight
Font weight for text in keyboard buttons.
--omni-keyboard-button-height
Height for keyboard buttons.
--omni-keyboard-button-width
Width for keyboard buttons.
--omni-keyboard-button-line-height
Line height for keyboard buttons.
--omni-keyboard-button-border-radius
Border radius for keyboard buttons.
--omni-keyboard-button-mobile-margin
Margin for keyboard buttons in mobile viewports.
--omni-keyboard-button-mobile-height
Height for keyboard buttons in mobile viewports.
--omni-keyboard-button-mobile-width
Width for keyboard buttons in mobile viewports.
--omni-return-keyboard-button-mobile-width
Width for return keyboard buttons in mobile viewports.
--omni-numeric-keyboard-button-mobile-width
Width for numeric keyboard buttons in mobile viewports.
--omni-keyboard-button-mobile-small-height
Height for keyboard buttons in small mobile viewports.
--omni-keyboard-button-mobile-small-width
Width for keyboard buttons in small mobile viewports.
--omni-keyboard-button-mobile-small-font-size
Font size for text in keyboard buttons in small mobile viewports.
--omni-keyboard-button-mobile-small-border-radius
Border radius for keyboard buttons in small mobile viewports.
--omni-return-keyboard-button-mobile-small-width
Width for return keyboard buttons in small mobile viewports.
--omni-numeric-keyboard-button-mobile-small-width
Width for numeric keyboard buttons in small mobile viewports.
--omni-keyboard-shadow-border-radius
Border radius for keyboard shadow.
--omni-keyboard-shadow-padding-bottom
Bottom padding for keyboard shadow.
--omni-keyboard-shadow-background-color
Background color for keyboard shadow.
--omni-keyboard-top-bar-width
Width for keyboard top bar.
--omni-keyboard-top-bar-padding-left
Left padding for keyboard top bar.
--omni-keyboard-top-bar-padding-right
Right padding for keyboard top bar.
--omni-keyboard-top-bar-background-color
Background color for keyboard top bar.
--omni-keyboard-top-bar-border-radius
Border radius for keyboard top bar.
--omni-keyboard-top-bar-border-bottom-color
Border bottom color for keyboard top bar.
--omni-keyboard-numeric-display-label-max-width
Width for display label in keyboard numeric mode.
--omni-keyboard-special-display-label-max-width
Width for display label in keyboard special mode.
--omni-keyboard-alpha-display-label-max-width
Width for display label in keyboard alpha-numeric mode.
--omni-keyboard-wrapper-width
Width for keyboard button rows wrapper.
--omni-keyboard-special-wrapper-width
Width for keyboard button rows wrapper for special keys.
--omni-keyboard-numeric-wrapper-width
Width for keyboard button rows wrapper for numeric keyboard mode.
--omni-keyboard-action-button-width
Width for keyboard call to action button.
--omni-keyboard-action-button-max-width
Max width for keyboard call to action button.
--omni-keyboard-action-button-color
Font or icon colour for keyboard call to action button.
--omni-keyboard-action-button-background-color
Background colour for keyboard call to action button.
--omni-keyboard-action-button-font-size
Font size for keyboard call to action button.
--omni-keyboard-action-button-font-weight
Font weight for keyboard call to action button.
--omni-keyboard-action-button-border-radius
Border radius for keyboard call to action button.
--omni-keyboard-action-button-margin
Margin for keyboard call to action button.
--omni-keyboard-close-icon-width
Width for keyboard close button icon.
--omni-keyboard-close-button-font-weight
Font weight for keyboard close button.
--omni-keyboard-close-button-color
Font colour for keyboard close button.
--omni-keyboard-close-button-font-size
Font size for keyboard close button.
--omni-keyboard-closer-width
Width for keyboard close button area.
--omni-keyboard-closer-padding-right
Right padding for keyboard close button area.
--omni-keyboard-background-color
Background color for keyboard.
--omni-keyboard-key-row-margin
Margin for keyboard rows.
--omni-keyboard-key-row-width
Width for keyboard rows.
--omni-keyboard-row-padding-top
Top padding for first keyboard row.
--omni-keyboard-row-padding-bottom
Bottom padding for last keyboard row.
--omni-keyboard-icons-color
Colour for keyboard icons.
--omni-keyboard-top-bar-mobile-height
Height for keyboard top bar in mobile viewports.
--omni-keyboard-top-bar-mobile-border-radius
Border radius for keyboard top bar in mobile viewports.
--omni-keyboard-mobile-numeric-display-label-max-width
Width for display label in keyboard numeric mode for mobile viewports.
--omni-keyboard-mobile-special-display-label-max-width
Width for display label in keyboard special mode for mobile viewports.
--omni-keyboard-mobile-alpha-display-label-max-width
Width for display label in keyboard alpha-numeric mode for mobile viewports.
--omni-keyboard-mobile-key-row-margin
Margin for keyboard rows in mobile viewports.
--omni-keyboard-mobile-special-key-row-margin
Margin for special keyboard rows in mobile viewports.
--omni-keyboard-mobile-key-row-width
Width for keyboard rows in mobile viewports.
--omni-keyboard-mobile-action-button-height
Height for keyboard call to action button in mobile viewports.
--omni-keyboard-mobile-action-button-max-width
Max width for keyboard call to action button in mobile viewports.
--omni-keyboard-mobile-action-button-margin
Margin for keyboard call to action button in mobile viewports.
--omni-keyboard-mobile-close-icon-width
Width for keyboard close button icon in mobile viewports.
--omni-keyboard-mobile-small-numeric-display-label-max-width
Width for display label in keyboard numeric mode for small mobile viewports.
--omni-keyboard-mobile-small-special-display-label-max-width
Width for display label in keyboard special mode for small mobile viewports.
--omni-keyboard-mobile-small-alpha-display-label-max-width
Width for display label in keyboard alpha-numeric mode for small mobile viewports.
--omni-keyboard-mobile-small-key-row-margin
Margin for keyboard rows in small mobile viewports.
--omni-keyboard-mobile-small-action-button-height
Height for keyboard call to action button in small mobile viewports.
--omni-keyboard-mobile-small-action-button-max-width
Max width for keyboard call to action button in small mobile viewports.