Contributing to Meshery UI - Sistent
Prerequisite Reading
Contributing to Meshery UI - Sistent
Sistent
is the Layer5 Design System - an open source design system that offers building blocks to create consistent, accessible, and user-friendly interfaces. Itβs aimed at developers who want to design applications aligned with the same brand and ensure a uniform user experience across different products.
Sistent leverages Material UI libraries and provides a custom theme on top of it for a consistent look and feel. It includes components, icons, and design tokens that developers can readily integrate into their applications. By using Sistent, developers can save time and effort while maintaining a high-quality user experience throughout Meshery.
Example
- This
Modal
is a Sistent Standard Modal used in validation of design.
How to use Sistent in Meshery UI
Table of Contents
The Sistent design system includes a variety of base components such as Button
, Textfield
, Checkbox
, and more, which can be found here
Additionally, it provides custom components like Modal
, TransferList
, and others, which are available here
Usage
- Import any base or custom component from
@layer5/sistent
. Hereβs how you can do it:
import {Button} from `@layer5/sistent`
function MyComponent() {
return (
<div>
<Button
variant="contained"
onClick={onClick}
>
{/* Text to display */}
</Button>
</div>
);
}
export default MyComponent;
- Wrap the Sistent component with
UsesSistent
wrapper.
ThisUsesSistent
wrapper ensures that the correct theme is applied to the Sistent component based on the current theme of the Meshery UI. Here how you can do it:
import { UsesSistent } from '<path>/SistentWrapper';
function MyComponent() {
return (
<div>
<UsesSistent>
<Button
variant="contained"
onClick={onClick}
>
{/* Text to display */}
</Button>
</UsesSistent>
</div>
);
}
export default MyComponent;
How to use Tokens/Colors
from Sistent theme
Letβs start with a few of the common terms that we will come across frequently, as understanding what they mean will inform us of applicable use cases and proper procedures that should not be overlooked.
-
Theme: A theme provides a cohesive and consistent look and feel for a product, achieved through harmonious color palettes, legible fonts, and layout patterns. Sistent specifies both light and dark themes.
-
Value: A value is a unique visual attribute assigned to a token via themes, such as hex codes or RGBA values, used to highlight specific colors. Avoid referencing exact values directly to ensure consistency; instead, use tokens to manage and implement reusable values.
-
Tokens: Tokens serve as a shared language between design and development, detailing how to build user interfaces. Tokens represent context (background, text, component), role (success, warning, brand, inverse), and modifiers (secondary, tertiary, hover) derived from the color palette.
-
Role: Roles specify the context for applying colors. Different roles can share the same value but will have different use cases due to the token structure. These values can vary depending on the current theme.
How to use these tokens/colors from sistent theme.
- Import
useTheme
hook from@layer5/sistent
to access the current theme - Use the
UsesSistent
wrapper to ensure the Sistent theme is applied to your components. - Utilize the
useTheme
hook to access theme properties and apply them to your components, such as setting the background style of theButton
.
import { UsesSistent } from '<path>/SistentWrapper';
import {Button, useTheme} from `@layer5/sistent`
function MyComponent() {
const theme = useTheme()
return (
<div>
<UsesSistent>
<Button
variant="contained"
onClick={onClick}
style = {{
background: theme.palette.background.default,
text: theme.palette.text.secondary
}}
>
{/* Text to display */}
</Button>
</UsesSistent>
</div>
);
}
export default MyComponent;
NOTE
The tokens and their roles are specific to their use. For example, use the background palette for background styles and the text palette for text styles.Suggested Reading
- Build & Release (CI) - Details of Meshery's build and release strategy.
- Contributing to Meshery Adapters - How to contribute to Meshery Adapters
- Contributing to Meshery CLI - How to contribute to Meshery Command Line Interface.
- Contributing to Meshery's End-to-End Tests using Cypress - How to contribute to End-to-End Tests using Cypress.
- Contributing to Meshery Docker Extension - How to contribute to Meshery Docker Extension
- Contributing to Meshery Docs - How to contribute to Meshery Docs.
- How to write MeshKit compatible errors - How to declare errors in Meshery components.
- Contributing to Meshery using git - How to contribute to Meshery using git
- Meshery CLI Contributing Guidelines - Design principles and code conventions.
- Contributing to Model Components - How to contribute to Meshery Model Components
- Contributing to Model Relationships - How to contribute to Meshery Models Relationships, Policies...
- Contributing to Models Quick Start - A no-fluff guide to creating your own Meshery Models quickly.
- Contributing to Models - How to contribute to Meshery Models, Components, Relationships, Policies...
- Contributing to Meshery Policies - How to contribute to Meshery Policies
- Contributing to Meshery Server Events - Guide is to help backend contributors send server events using Golang.
- Contributing to Meshery UI - Notification Center - How to contribute to the Notification Center in Meshery's web-based UI.
- Contributing to Meshery's End-to-End Tests - How to contribute to End-to-End Tests using Playwright.
- Contributing to Meshery UI - How to contribute to Meshery UI (web-based user interface).
- Contributing to Meshery Server - How to contribute to Meshery Server
- Setting up Meshery Development Environment on Windows - How to set up Meshery Development Environment on Windows