Skill

ui-layout-guide

UI layout optimization guide for Angular pages. Use when reviewing or creating page layouts, dashboard cards, info grids, or any UI component that needs consistent styling.

From one-ui-migration
Install
1
Run in your terminal
$
npx claudepluginhub michael0520/milo-claudekit --plugin one-ui-migration
Tool Access

This skill uses the workspace's default tool permissions.

Skill Content

UI layout optimization guide for Angular pages. This skill provides guidance on using shared styles and creating consistent, clean layouts.

Arguments

  • $ARGUMENTS - Query or command:
    • review <path> - Review component for layout optimization
    • dashboard - Dashboard card layout patterns
    • card - Card component patterns
    • grid - Grid and info-grid patterns
    • spacing - Margin and padding utilities
    • text - Text styling classes
    • form - Form layout patterns
    • Or ask any question about UI layout

Shared Styles Location

All shared styles are in libs/mxsecurity/shared/styles/:

FilePurpose
_layout.scssMargin/padding utilities (.mr-4, .mt-8, .p-16, etc.)
_text.scssText color classes (.text-on-surface-variant)
_form.scssForm layout (.form-row, .form-column)
_shared.scssMain entry point, includes .content-wrapper
_table.scssTable-specific styles
_material-custom.scssMaterial UI overrides
_formoxa-custom.scssFormOXA UI overrides

Layout Utilities Reference

Margin Classes (from _layout.scss)

Generated for sizes 4, 8, 12, 16, 20, 24, 28, 32, 36, 40 (px):

.mr-{size}  // margin-right
.ml-{size}  // margin-left
.mt-{size}  // margin-top
.mb-{size}  // margin-bottom
.mx-{size}  // margin left + right
.my-{size}  // margin top + bottom
.m-{size}   // margin all sides

Padding Classes (from _layout.scss)

Generated for sizes 4, 8, 12, 16, 20, 24, 28, 32 (px):

.pr-{size}  // padding-right
.pl-{size}  // padding-left
.pt-{size}  // padding-top
.pb-{size}  // padding-bottom
.px-{size}  // padding left + right
.py-{size}  // padding top + bottom
.p-{size}   // padding all sides

Text Classes (from _text.scss)

.text-on-surface-variant     // Secondary text color
.text-on-surface-variant-op-38  // Disabled text (38% opacity)

Form Layout Classes (from _form.scss)

.form-row {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 8px;
}

.form-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

Dashboard Card Patterns

Standard Card Structure

<mat-card class="dashboard-card">
  <mat-card-header>
    <mat-card-title class="card-title-row">
      <span class="card-title">{{ title }}</span>
      <div class="header-actions">
        <!-- Optional: refresh button, menu, etc. -->
      </div>
    </mat-card-title>
  </mat-card-header>
  <mat-card-content>
    <!-- Card content -->
  </mat-card-content>
  <mat-card-actions align="end">
    <!-- Optional: action buttons -->
  </mat-card-actions>
</mat-card>

Card Grid Layout

.card-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;

  @media (max-width: 900px) {
    grid-template-columns: 1fr;
  }
}

Key-Value Pattern (for key-value displays)

Use FormOXA's mx-key-value component instead of raw <dt> / <dd> elements:

Import in component:

import { MxKeyValueComponent, MxKeyValueGroupDirective } from '@moxa/formoxa/mx-key-value';

@Component({
  imports: [MxKeyValueComponent, MxKeyValueGroupDirective],
  // ...
})

Template usage:

<mx-key-value-group>
  <mx-key-value
    [key]="t('features.example.label')"
    keySize="md"
    [value]="data().value"
    valueSize="md"
    direction="horizontal"
  ></mx-key-value>
  <mx-key-value
    [key]="t('features.example.another_label')"
    keySize="md"
    [value]="data().anotherValue"
    valueSize="md"
    direction="horizontal"
  ></mx-key-value>
</mx-key-value-group>

Properties:

  • key - Label text (supports i18n)
  • value - Display value
  • keySize - Key font size: 'sm' | 'md' | 'lg'
  • valueSize - Value font size: 'sm' | 'md' | 'lg'
  • direction - Layout direction: 'horizontal' | 'vertical'

Best Practices

DO

  • Use shared utility classes for spacing (.mt-16, .mb-8)
  • Use CSS Grid for card layouts
  • Use Flexbox for single-direction layouts
  • Use Material Design color tokens via one-theme
  • Keep consistent gap sizes (8px, 16px)
  • Use responsive breakpoints (900px for 2-col, 600px for 1-col)

DON'T

  • Hardcode colors - use theme variables
  • Mix margin/padding in component styles when utilities exist
  • Create duplicate layout classes that exist in shared styles
  • Use different gap sizes across similar components

Color Usage

Always use theme colors from one-theme:

@use 'sass:map';
@use 'one-theme' as *;

.label {
  color: map.get($mx-light, onSurfaceVariant);  // Secondary text
}

.value {
  color: map.get($mx-light, onSurface);  // Primary text
}

.background {
  background-color: map.get($mx-light, surface);
}

Review Checklist

When reviewing a component for layout optimization:

  1. Uses shared spacing utilities where appropriate
  2. Uses theme colors instead of hardcoded values
  3. Grid layouts are responsive
  4. Consistent gap sizes (8px or 16px)
  5. Card headers use .card-title-row for flex layout
  6. Info displays use mx-key-value component from FormOXA
  7. No duplicate styles that exist in shared files
Similar Skills
cache-components

Expert guidance for Next.js Cache Components and Partial Prerendering (PPR). **PROACTIVE ACTIVATION**: Use this skill automatically when working in Next.js projects that have `cacheComponents: true` in their next.config.ts/next.config.js. When this config is detected, proactively apply Cache Components patterns and best practices to all React Server Component implementations. **DETECTION**: At the start of a session in a Next.js project, check for `cacheComponents: true` in next.config. If enabled, this skill's patterns should guide all component authoring, data fetching, and caching decisions. **USE CASES**: Implementing 'use cache' directive, configuring cache lifetimes with cacheLife(), tagging cached data with cacheTag(), invalidating caches with updateTag()/revalidateTag(), optimizing static vs dynamic content boundaries, debugging cache issues, and reviewing Cache Component implementations.

138.5k
Stats
Parent Repo Stars0
Parent Repo Forks0
Last CommitJan 24, 2026