Skip to content
API 风格:

Spinner ​

A basic rotating figure indicating an in-progress state. The loading mask (LhLoading) renders it internally as well.

Basic usage ​

Sizes
vue
<script setup lang="ts">
</script>

<template>
  <div class="demo-spinner-row">
    <LhSpinner size="small" />
    <LhSpinner size="medium" />
    <LhSpinner size="large" />
  </div>
</template>
vue
<script>
export default {}
</script>

<template>
  <div class="demo-spinner-row">
    <LhSpinner size="small" />
    <LhSpinner size="medium" />
    <LhSpinner size="large" />
  </div>
</template>

Custom color ​

Color
vue
<script setup lang="ts">
</script>

<template>
  <div class="demo-spinner-row">
    <LhSpinner color="#8f9779" />
    <LhSpinner color="#b55442" />
    <LhSpinner color="#4a6fa5" />
  </div>
</template>
vue
<script>
export default {}
</script>

<template>
  <div class="demo-spinner-row">
    <LhSpinner color="#8f9779" />
    <LhSpinner color="#b55442" />
    <LhSpinner color="#4a6fa5" />
  </div>
</template>

API ​

LhSpinner Props ​

AttributeDescriptionTypeDefault
sizeSize"small" | "medium" | "large" | "mini" | "x-large"'medium'
colorRotation color (CSS color value; inherits currentColor when unset)string—
sxQuick layout propsLhSxProps—

Accessibility ​

  • Purely decorative: aria-hidden="true" removes it from the accessibility tree; the in-progress semantics belong to an outer container (e.g. role="status")
  • The rotation respects prefers-reduced-motion, degrading to a static arc

Type Definitions ​

The TypeScript type structures exported by this component (auto-extracted from packages/components/spinner/src/types.ts and @lh-ui/share/core/* sources; click each entry to expand; see the Props table above for attribute descriptions):

LhSpinnerProps
ts
export interface LhSpinnerProps {
  size?: LhSpinnerSize
  color?: string
  sx?: LhSxProps
}
LhSpinnerSize (from @lh-ui/share/core/spinner)
ts
export type LhSpinnerSize = (typeof LH_SPINNER_SIZE_CONST)[keyof typeof LH_SPINNER_SIZE_CONST];

Constants ​

Public constants used by this component (linked from the Type / Default columns in the Props table above):

LH_SPINNER_SIZE_CONST (from @lh-ui/share/core/spinner)
ts
export declare const LH_SPINNER_SIZE_CONST: {
    readonly small: "small";
    readonly medium: "medium";
    readonly large: "large";
    readonly mini: "mini";
    readonly old: "x-large";
};
LH_SPINNER_SIZE_PX (from @lh-ui/share/core/spinner)
ts
export declare const LH_SPINNER_SIZE_PX: Record<LhSpinnerSize, number>;

Beauty of tradition, foundation of code