Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
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 checkbox component allows users to select one or multiple options from a given set of choices.
By default, the checkbox appears before the label, but this order can be changed using the isLabelFirst
option.
For more information: Storybook for checkbox 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.
DIGIT UI components is a collection of common Flutter widgets designed to simplify UI development. These components offer easy-to-use and customizable features to enhance UI design and streamline the development process.
Add this to your pubspec.yaml file:
Then run:
Import the package in your Dart code:
Atom | Variants | States |
---|
This page outlines methods to reduce UI/UX audit bugs post-development by enhancing a UI library. Key improvements include:
These enhancements aim to streamline development and ensure a consistent, user-friendly interface.
To resolve UI/UX audit issues, we will implement new components featuring enhanced functionality, modern design, and superior performance. These elements should adhere to current design trends and meet user expectations to improve the user experience. Below is the list of DIGIT Components
Standardising design principles ensures consistency across the UI library, reducing the likelihood of UI/UX audit bugs. This involves establishing design guidelines, naming conventions, and component usage patterns.
Enhancing the stability of the UI library is crucial for reducing UI/UX audit bugs. This includes optimizing code quality, implementing robust testing strategies, and monitoring performance to identify and address potential issues.
Transitioning from px to em units improves scalability and accessibility, reducing UI/UX audit bugs related to inconsistent text sizes and layouts across different devices and screen resolutions.
Storybook provides a development environment for testing and documenting components, helping to identify and address UI/UX audit bugs early in the development process.
Implementing colour and text size constants ensures consistency in styling across the UI library, reducing UI/UX audit bugs related to colour contrast, readability, and visual hierarchy.
Introducing newer component variants enhances flexibility and caters to diverse user requirements, reducing UI/UX audit bugs related to limited functionality or options.
Creating Flutter widgets extends the UI library's reach to mobile platforms, reducing UI/UX audit bugs related to inconsistent user experiences across different devices and operating systems.
Implementing the improvements discussed here ensures the UI library is better equipped to reduce UI/UX audit bugs after development. These enhancements promote consistency, scalability, accessibility, and cross-platform compatibility, resulting in a more polished and user-friendly experience for end-users.
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:
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.
DIGIT UI components include various text input fields with optional features such as character count display, inner labels, and help text. These fields also come with built-in validation support for improved data integrity.
Text Input Field: A text input field for general alphanumeric data.
Text Area Input Field: For multi-line text input.
Search Input Field: Designed for search queries or search-related inputs.
Password Input Field: A secure input field for password entry.
Numeric Input Field: This field is suitable for numeric input.
Date Input Field: An input field designed to capture dates.
Time Input Field: Use this field to input time values.
Location Input Field: Specifically for geographic location data, such as coordinates.
These are some common props which can be sent inside all the input fields:
TextAreaScroll
Usages
Usages
Usages
Usages
Usages
Usages
Usages
Usages
Label | Label for text field |
---|---|
For more information:
For more information:
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
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"
This widget is a versatile and customizable checkbox component. It provides a checkbox with an associated label and allows users to toggle between checked and unchecked states. This widget supports various customisation options, including the ability to customise the checkbox icon colour, label, padding, and disabled state.
The widget provides a hover state, visually indicating when the user hovers over the checkbox. This is useful for enhancing the user experience.
This widget contains the following required parameters:
These are some option parameters:
Usages
Add the following lines of code:
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).
For more information: Storybook for Toast
DIGIT UI components provide a variety of buttons with optional suffix and prefix icons, contributing to a cohesive and visually appealing UI.
Button Type
Primary: Represents the primary action. It features a prominent colour, and its appearance can change on hover or click.
Secondary: Offers a secondary action. It has a different colour scheme than the primary button.
Tertiary: Provides a tertiary action with a distinct visual style.
Link: Resembles a hyperlink, suitable for navigation or linking to other parts of the application. It typically includes an underline.
Hover and Disabled State
The DigitButton widget handles hover effects and a disabled state. When the button is hovered over, it can exhibit visual changes depending on its type. The disabled state prevents interaction and adjusts the button's appearance accordingly.
Icon Placement
The widget supports the placement of icons both before and after the label text. This allows for flexibility in button design.
Properties
It contains the following required Parameters:
These are some optional parameters:
To use the primary button add the below lines of code:
With suffix Icon:
With prefix Icon:
To use the secondary button add the following lines of code:
Prefix and Suffix icons can be added to the secondary button using the same code as given for the primary button.
To use the tertiary button add the below lines of code:
To use a link, add the following lines of code:
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.
For more information: StoryBook for simple dropdown
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.
For more information: Storybook for nesteddropdown varinat
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.
For more information: Storybook for treedropdown
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.
For more information: StoryBook for nestedtext dropdown.
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.
For more information: Storybook for profiledropdown
Profilenestedtext Dropdown
For more information: Storybook for 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.
For more information: Storybook for multiselect dropdown
Nested MultiSelect Dropdown
Multiple options can be selected for each category.
For more information: Storybook for nested multiselect dropdown
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.
For more information: Storybook for treemultiselect dropdown
NestedText MultiSelect Dropdown
For more information: Storybook for Nestedtext Multiselect Dropdown
The Toggle Buttons component in DIGIT UI presents a list of interactive toggle buttons, providing users with the ability to select an option. Each button is equipped with callbacks for both mouse-down and hover effects, ensuring a responsive and engaging user interface.
The widget contains the following required parameters:
Below are some additional parameters:
Usages
Add the following lines of code:
The Radio Buttons component in DIGIT UI empowers users to make a single selection from a list of options. This intuitive interface provides a smooth user experience with hover and mouse-down effects. It is designed to handle both horizontal and vertical layouts based on the screen width.
Below are some required parameters inside the radio list:
The following are additional parameters:
Usages
Add the below lines of code to configure the radio button:
|
|
|
Text Date Time Geolocation Numeric Password Search TextArea | Default Filled Disabled NonEditable Focus Error Label Character Count Inner Label Info Help Text/ Description |
Radio Selection | Default Disabled Selected PreSelected |
Toggle | Default Disabled Selected PreSelected |
Primary Secondary Tertiary Link | Active Disabled Label Interactions |
Single Select Multi Select Sub type: Default Nested Tree | Default Disabled Selected Interactions |
Default Checked | Active Disabled Label Interactions |
Success Warning Failure |
Default Success Warning Error |
DIGIT UI components offer various drop-down menus, including single-select, multi-select, and tree-select options.
The Single Select drop-down in Digit UI Components provides a drop-down menu for users to make a single selection. It supports various features such as item filtering and selection handling. This intuitive component supports options with additional features such as images, icons, and descriptions, complemented by hover and mouse-down effects.
Sub-Types
Default drop-down
Nested drop-down
Tree drop-down
Below are some required parameters:
These are some additional customisation parameters:
DropdownItem
Inside the dropdown item, we can pass additional parameters to include the drop-down like description, image and icons.
There are the customisations available inside the drop-down item:
TreeNode
Inside the tree node we can pass a list of children associated with a node:
Usages
Default drop-down
With description and profile image:
Nested drop-down
Tree drop-down
The Multi-Select drop-down in DIGIT UI components offers a user-friendly interface for selecting multiple options simultaneously. This clean and intuitive component is equipped with built-in chips and provides responsive mouse-down and hover effects.
Sub-Types
Default drop-down
Nested drop-down
Tree drop-down
Below are some required parameters:
These are some additional parameters:
Usages
Default Drop-down
Nested Drop-down
Tree Drop-down
Key components of DIGIT-UI
This page provides the architecture and key features of the DIGIT UI. Click on the broader headings below to find the details.
Broadly, the DIGIT UI frontend components are categorized as below:
The CSS Library contains all the classes both in the module and compiled form.
This can be imported using import "@egovernments/digit-ui.css/Button"
or full CSS import using import "@egovernments/digit-ui.css"
The Component Library contains a set of all required components defined in it.
The libraries and utils contain the following:
Localization workflows
API Handling Strategies - Centralize API caching and handling strategies within shared functions, accessible by all modules. This ensures consistency and efficiency across the application.
Localisation
The module is a closed system for states, allowing access only to node_modules or CDNs. State-specific components can be provided during the module's initialization in the employee or citizen application.
Below is an illustration of how the module structure looks like:
Modules contain the following inbuilt
Theme - this may change if we later decide to use any css-in-js
library, like styled-components
.
Components
Routes
State management
Business logic
API integrations
The first line contains the Architecture Component name or info
The second line contains an npm package and a template in brackets for creating the component.
Easy-to-use CLI
Handles all modern JS features
Bundles commonjs
and es
module formats
create-react-app for example usage and local dev for React-based libraries
Rollup for bundling
Babel for transpiling
Supports complicated peer-dependencies
Supports CSS modules
The templates have the following folder structure: Components related to the template are inside the src
folder. An example is provided to demonstrate the app created by the template.
We have two main React Apps:
micro-ui-internals
This is meant for the eGov development team to build components and default modules.
It contains the following modules:
CSS Library
UI Components (presently react-components
)
Utils Library: Contains Services, Localization handling and React Hooks.
UI Modules
Core - containing login, routing and global state.
PGR
FSM
PT
Payment
etc ...
micro-ui
This is meant for the state team to manage, make changes, and deploy
It allows the import of digit-ui-internals
modules
Customizations
View
Services
Build and deploy scripts
Dockerfile & nginx.conf
build-config.yaml
The app imports the developed module.
In the next phase, we can merge the Employee and Citizen apps into one app with role-based permissions and content.
This widget is a versatile and customizable information card designed inside a digit ui widget. It provides a visually appealing way to display information, with options for different types of information.
The Info Card supports different types of information, each with its distinct visual style:
Info: Default information card with a blue background and an information icon.
Success: This represents a successful operation, featuring a green background and a check-circle icon.
Error: Indicates an error or unsuccessful operation with a red background and an error icon.
Warning: Represents a warning or caution, featuring a yellow background and a warning icon.
Developers can include additional widgets beneath the description for extra information or interactive elements. The inline property controls whether these widgets are displayed horizontally or vertically.
Info cards contain the following required parameters:
There are some additional customisation parameters:
Usages
Info Card
Success Card
Error Card
Warning Card
The Toast widget provides a customizable toast notification for Flutter applications. It is designed to display short-lived messages, alerts, or notifications to users in a visually appealing and informative manner.
The ToastType enumeration defines different types of toasts, including:
success: Indicates a successful operation.
error: Indicates an error or failure.
warning: Indicates a warning or caution.
The Toast widget provides a static method for displaying toasts. This method includes the following parameters:
Usage
Success Toast
Error Toast
Warning Toast
selectedOptions List of DropdownItem, which will be selected by default