Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
A toggle UI component is a user interface element that allows users to switch between two states, typically "on" and "off" or "enabled" and "disabled".
For more information: StoryBook for toggle field
Radio button components enable users to select a single option from a list of alternatives.
While using the radio component independently and to disable it set the prop as disabled={true}.
For more information: Storybook for radio field
The Input field enables users to interact with the application through content input and data. The component allows users to input responses or data based on specific requirements.
Type: text
Below are the details for the type: text:
Example Usage of TextInput Component
For more information: StoryBook for Text Input field
Type: date
The date can be selected from the date chart. If editableDate is set to true, the date can be edited without using the date chart; otherwise, it cannot be edited.
For more information: StoryBook for date field
Type: time
The time can be selected from the time chart. If editableTime
is set to true
, the time can be edited without using the time chart; otherwise, it cannot be edited.
For more information: StoryBook for time field
Type: geolocation
Click on the geolocation icon to call and activate the onIconSelection function. Otherwise, the location details are captured by default.
For more information: StoryBook for Geolocation field
Type: numeric
The numeric value by default increases and decreases by step value 1. But it can be configured using the step value sent as a prop in the config.
For more information: StoryBook for Numeric field
With Prefix and Suffix
Type: password
For more information: Storybook for password field
Type: search
There are two variants for the textarea - one has a resize option and the other is resizeSmart which auto-adjusts the height based on the input content.
For more information: Storybook for TextArea
Migration guide to aid users in shifting from the "react-components" package to the "components-core" package
Topics covered:
This document details the essential modifications needed in the modules for smooth integration of components from the "components-core" package. It offers precise guidelines on utilizing FormComposerV2 and InboxSearchComposer, along with updates made in the configs.
In the components-core package, several enhancements have been implemented to improve code clarity and address issues related to pixel inconsistencies. Previously, there were challenges associated with pixel-based sizing, leading to inconsistencies across different devices and screen resolutions. To mitigate this, the codebase has been updated to utilize rems as the primary unit of measurement. This transition to rems offers several advantages over pixels, including improved scalability and responsiveness across various viewport sizes.
Adopting rems ensures the components' styling is more consistent and adaptable, providing a seamless user experience across different platforms and devices.
Furthermore, TextInput, TextArea, Radio, Button, Checkbox, Toggle, Dropdown, Multiselectdropdown, InfoCard, and Toast offer different variants. Adding variants for these components makes them more flexible, serving a wider range of purposes and meeting different design needs effectively.
These are some of the updates made in the components-core package.
Atom | Variants | State |
---|---|---|
To install:
Add the dependency in the frontend/micro-ui/web/package.json
Syntax for importing any components:
Syntax for importing FormComposerV2:
In the micro-ui/web/micro-ui-internals/packages/modules/Project/src/pages/employee/CreateProject/CreateProjectForm.js:
In the micro-ui/web/micro-ui-internals/packages/modules/Project/package.json :
Add “@egovernments/digit-ui-components-core”:”0.0.1” in the dependencies.
And when you import any component the syntax for the import statement is:
In the micro-ui/web/micro-ui-internals/packages/modules/Project/src/pages/employee/ProjectWMSSearch:
Verify the components in the sample module:
Sample module Integrated with new components
These are some of the modifications that need to be done in the modules to use the components from the components-core package.
Buttons are used for specific user actions. These clickable UI components allow the users to interact with the system.
Primary Variant
Secondary Variant
Tertiary Variant
Link Variant
Icons are sent as a string added before the label. To add it as a suffix, set the isSuffix parameter to true.
The Toast component is used to provide users with temporary notifications. It does not require any user action.
Success Toast
Warning Toast
Error Toast
The default transitionTime for any variant of toast is 5 seconds. However, this is configurable using the transitionTime prop (in milliseconds).
A dropdown UI component is a user interface element that allows users to select one option from a list of choices. When the dropdown is clicked, it expands to reveal the list of options, and the user can click an item to select it. This component is often used in forms and navigation menus to save space and organize options efficiently.
Simple Dropdown
To show the icons beside each option, set the showIcon prop to true. Send the icons as a string along with the required options. The dropdown is searchable but can be configured using the isSearchable prop.
To reset the option after selecting it, clear the option and click enter.
Nested Dropdown
For the type dropdown with the "nesteddropdown" variant, options can be configured as shown above. Icons are optional but can be included if needed. The search results are displayed as per the main category names.
Tree Dropdown
Here's a simplified version of your explanation:
For the type dropdown with the "treedropdown" variant, options can be configured as shown in the configuration above. Currently, the treedropdown does not support icons. Clicking on the parent option displays the child options. The final child options are enabled for selection.
This version maintains the necessary details while being clear and concise.
NestedText Dropdown
For the type
dropdown with the variant nestedtextdropdown
, use the above configuration details to define the options.
Use this variant when you need to describe each option.
Profile Dropdown
For the type dropdown with the "profiledropdown" variant, use the configuration details above to define the options.
You can set any image as a profileIcon as shown in the configuration.
Profilenestedtext Dropdown
Simple MultiSelect Dropdown
For a multi-select dropdown, set options in the format given in the above configuration.
Ignore these If icons are not needed. Else, set the showIcon to true. Set the isDropdownWithChip parameter to true to show chips once the options are selected.
Configure the clearLabel param to ensure the chips are cleared from the label.
Nested MultiSelect Dropdown
Multiple options can be selected for each category.
Tree MultiSelect Dropdown
In a tree multiselect dropdown, you can select both parent and child options. Choosing a child option does not automatically select the parent option. When only some child options are selected, the parent option will show in an intermediate state.
Selecting any parent option will automatically select all its child options.
NestedText MultiSelect Dropdown
The InfoCard component has four variants: default, success, error and warning. The default labels for these variants are Info, Success, Error and Warning.
However, the label can be configured using the label prop. The configuration enables users to set the array of elements for display in the info card component.
By default, the elements are shown in the vertical direction. To show the elements in the horizontal direction set the inline prop to true.
With Additional Elements:
Label | Label for text field |
---|---|
For more information:
For more information:
For more information:
For more information:
For more information:
For more information:
For more information: .
For more information:
For more information:
For more information:
For more information:
For more information:
For more information:
For more information:
Text
Date
Time
Geolocation
Numeric
Prefix
Suffix
Password
Search
Default
Filled
Disabled
NonEditable
Focus
Error
Label
Character Count
Inner Label
Info
Help Text/ Description
Default
Filled
Disabled
NonEditable
Focus
Error
Label
Character Count
Inner Label
Info
Help Text/ Description
resizeSmart
Radio Selection
Default
Disabled
Selected
PreSelected
Toggle
Default
Disabled
Selected
PreSelected
Primary
Secondary
Teritiary
Link
Active
Disabled
Label
Interactions
Default
Nested
Tree select
Profile
Profile with nested text
Nested Text
Default
Disabled
Selected
Interactions
Default
Nested
Tree Multiselect
Nested Text Multiselect
Default
Disabled
Selected
Interactions
Default
Checked
Active
Disabled
Label
Interactions
Success
Warning
Failure
Default
Success
Warning
Error
import {FormComposerV2} from "@egovernenets/digit-ui-components-core"
placeholder
Placeholder for the text field
isMandatory
Whether field is mandatory or not
disable
To disable the text field (no interaction will be possible if disabled)
nonEditable
To make text field readOnly
infoMessage
Information to be shown when hovered on the info icon beside the label
description
Help text for the text field
charCount
Number of characters in the input value
withoutLabel
Default will be false, if sent as true then label won't be shown
populators
Name : Mandatory field
Error : Error message to be shown
Validations: if required like maxlength, minlength etc
customIcon: to show any icon inside the text field (can be sent as a string)
onIconSelection: IconSelection function
Prefix: To show prefix
Suffix: to show suffix
wrapLabel
Can wrap label to the next line in desktop and tablet screens