Skip to content

Design Specification

YH-UI follows modern design principles to provide a consistent, beautiful, and easy-to-use user interface.

Design Principles

1. Consistency

Maintain visual and interactive consistency:

  • Visual Consistency: Components with the same function have the same appearance.
  • Interactive Consistency: The same operations provide the same feedback.
  • Language Consistency: Use unified terminology and phrasing.

2. Feedback

Every user action should have clear feedback:

  • Instant Feedback: Button clicks have hover/active states.
  • Progress Feedback: Loading states show when an operation is in progress.
  • Result Feedback: Message/Notification informs the user of the result of an operation.

3. Efficiency

Reduce the user's operational cost:

  • Reduce Steps: Simplify processes and minimize unnecessary actions.
  • Provide Default Values: Sensible default configurations.
  • Keyboard Friendly: Support for Tab navigation and keyboard shortcuts.

4. Controllability

Users should be able to control the interface:

  • Undoable: Support for undoing operations.
  • Configurable: Provide customization options.
  • Predictable: Operational results are as expected.

Color System

Brand Colors

ColorVariable NamePurpose
#409eff--yh-color-primaryPrimary actions, links, active states
#67c23a--yh-color-successSuccess, completion, correct
#e6a23c--yh-color-warningWarnings, reminders
#f56c6c--yh-color-dangerErrors, danger, deletion
#909399--yh-color-infoInformation, descriptions

Text Colors

ColorVariable NamePurpose
#303133--yh-text-color-primaryHeadings, primary text
#606266--yh-text-color-regularBody content
#909399--yh-text-color-secondarySecondary information
#a8abb2--yh-text-color-placeholderPlaceholder text
#c0c4cc--yh-text-color-disabledDisabled states

Border Colors

ColorVariable NamePurpose
#dcdfe6--yh-border-colorDefault borders
#e4e7ed--yh-border-color-lightLight borders
#ebeef5--yh-border-color-lighterLighter borders

Typography System

Font Families

css
--yh-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 
                  'Helvetica Neue', Arial, 'Noto Sans', sans-serif;

--yh-font-family-monospace: 'SFMono-Regular', Consolas, 'Liberation Mono', 
                             Menlo, Courier, monospace;

Font Sizes

VariableSizePurpose
--yh-font-size-extra-large20pxLarge headings
--yh-font-size-large18pxHeadings
--yh-font-size-medium16pxSubheadings
--yh-font-size-base14pxBody (Default)
--yh-font-size-small13pxSupporting text
--yh-font-size-extra-small12pxLabels, descriptions

Line Heights

VariableValuePurpose
--yh-line-height-tight1.3Compact text
--yh-line-height-normal1.5Body text
--yh-line-height-loose1.7Multi-line text

Spacing System

Based on a 4px spacing system:

VariableValuePurpose
--yh-spacing-xs4pxMinimal spacing
`--yh-spacing-sm"8pxSmall spacing
`--yh-spacing-md"16pxMedium spacing
`--yh-spacing-lg"24pxLarge spacing
`--yh-spacing-xl"32pxExtra large spacing

Border Radius

VariableValuePurpose
--yh-radius-sm2pxSmall elements
--yh-radius-base4pxDefault
--yh-radius-md8pxMedium
--yh-radius-lg12pxLarge elements
--yh-radius-round20pxRounded buttons

Shadows

VariablePurpose
--yh-shadow-smSubtle shadow, e.g., cards
--yh-shadow-baseDefault shadow, e.g., dropdown menus
--yh-shadow-mdMedium shadow, e.g., pop-ups
--yh-shadow-lgLarge shadow, e.g., modal dialogs

Animations

Duration

VariableValuePurpose
--yh-duration-fast100msRapid feedback
--yh-duration-base200msDefault animations
--yh-duration-slow300msComplex animations

Timing Functions

VariableValuePurpose
--yh-timing-easeeaseDefault
--yh-timing-ease-inease-inEntrance
--yh-timing-ease-outease-outExit
--yh-timing-ease-in-outease-in-outSmooth

Z-index Layers

VariableValuePurpose
--yh-z-index-normal1Normal elements
--yh-z-index-top1000Top elements
--yh-z-index-popper2000Pop-up layers
--yh-z-index-overlay2001Mask layers
--yh-z-index-modal2002Modal dialogs
--yh-z-index-popover2003Popovers
--yh-z-index-tooltip2004Tooltips
--yh-z-index-loading2005Loading layers

Responsive Breakpoints

VariableValueDevice
--yh-breakpoint-xs0Extra small screen
--yh-breakpoint-sm576pxMobile landscape
--yh-breakpoint-md768pxTablet
--yh-breakpoint-lg992pxSmall desktop
--yh-breakpoint-xl1200pxDesktop
--yh-breakpoint-xxl1400pxLarge desktop

Accessibility Design

YH-UI adheres to WCAG 2.1 AA standards:

  • Color Contrast: Text and background contrast ratio ≥ 4.5:1.
  • Focus Visibility: All interactive elements have clear focus styles.
  • Keyboard Navigation: Full support for keyboard-only operation.
  • Semantic Structure: Use correct ARIA attributes.
  • Reduced Motion: Support for prefers-reduced-motion.

More Resources

Released under the MIT License.