-
Notifications
You must be signed in to change notification settings - Fork 50.9k
docs: Add component specification for N8nLoading with API definition and usage examples #22055
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
cstuncsik
wants to merge
1
commit into
master
Choose a base branch
from
ds-309-write-loader-api-specs
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+189
−0
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
189 changes: 189 additions & 0 deletions
189
...ages/frontend/@n8n/design-system/src/v2/components/Loading/component-loading.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,189 @@ | ||
| # Component specification | ||
|
|
||
| Displays loading placeholders (skeleton screens) while content is being fetched or processed. Provides visual feedback to users that content is loading without showing a blank screen. | ||
|
|
||
| - **Component Name:** N8nLoading | ||
| - **Figma Component:** TBD | ||
| - **Element+ Component:** [ElSkeleton](https://element-plus.org/en-US/component/skeleton.html) | ||
| - **Reka UI Component:** [Primitive](https://reka-ui.com/docs/utilities/primitive) (no native Skeleton component) | ||
| - **Nuxt UI Component:** [Skeleton](https://ui.nuxt.com/docs/components/skeleton) | ||
|
|
||
|
|
||
| ## Public API Definition | ||
|
|
||
| **Props** | ||
|
|
||
| - `animated?: boolean` - Controls whether the skeleton shows pulsing animation. Default: `true` | ||
| - `loading?: boolean` - Controls whether the loading skeleton is displayed. When `false`, the skeleton is hidden. Default: `true` | ||
| - `rows?: number` - Number of skeleton rows to display. Default: `1` | ||
| - `cols?: number` - Number of skeleton columns to display. When set (non-zero), overrides row-based layout. Default: `0` | ||
| - `shrinkLast?: boolean` - Whether to shrink the last row to a shorter width. Only applies to `'h1'` and `'p'` variants when `rows > 1`. Default: `true` | ||
| - `variant?: SkeletonVariant` - Visual variant determining the shape and style of skeleton items. Values: `'custom' | 'p' | 'text' | 'h1' | 'h3' | 'caption' | 'button' | 'image' | 'circle' | 'rect'`. Default: `'p'` | ||
|
|
||
| **Events** | ||
|
|
||
| None - This is a purely presentational component. | ||
|
|
||
| **Slots** | ||
|
|
||
| None - Content is generated based on props. | ||
|
|
||
| ### Template usage example | ||
|
|
||
| **Basic loading with rows:** | ||
| ```typescript | ||
| <script setup lang="ts"> | ||
| import { N8nLoading } from '@n8n/design-system' | ||
| </script> | ||
|
|
||
| <template> | ||
| <!-- Simple 3-row skeleton --> | ||
| <N8nLoading :rows="3" /> | ||
|
|
||
| <!-- Conditional loading with 5 rows --> | ||
| <N8nLoading :loading="isLoading" :rows="5" /> | ||
| </template> | ||
| ``` | ||
|
|
||
| **Variant-specific loading:** | ||
| ```typescript | ||
| <script setup lang="ts"> | ||
| import { N8nLoading } from '@n8n/design-system' | ||
| </script> | ||
|
|
||
| <template> | ||
| <!-- Heading skeleton --> | ||
| <N8nLoading variant="h1" /> | ||
|
|
||
| <!-- Button skeleton --> | ||
| <N8nLoading variant="button" /> | ||
|
|
||
| <!-- Paragraph skeleton with 3 rows --> | ||
| <N8nLoading variant="p" :rows="3" /> | ||
|
|
||
| <!-- Rectangular shape --> | ||
| <N8nLoading variant="rect" /> | ||
|
|
||
| <!-- Image placeholder --> | ||
| <N8nLoading variant="image" /> | ||
|
|
||
| <!-- Text skeleton --> | ||
| <N8nLoading variant="text" /> | ||
|
|
||
| <!-- Custom size (100% width/height) --> | ||
| <N8nLoading variant="custom" /> | ||
| </template> | ||
| ``` | ||
|
|
||
| **Without shrinking the last row:** | ||
| ```typescript | ||
| <script setup lang="ts"> | ||
| import { N8nLoading } from '@n8n/design-system' | ||
| </script> | ||
|
|
||
| <template> | ||
| <!-- All rows will be full width --> | ||
| <N8nLoading :rows="10" :shrink-last="false" /> | ||
| </template> | ||
| ``` | ||
|
|
||
| **Controlling animation:** | ||
| ```typescript | ||
| <script setup lang="ts"> | ||
| import { ref } from 'vue' | ||
| import { N8nLoading } from '@n8n/design-system' | ||
|
|
||
| const loading = ref(true) | ||
| const loadingRows = ref(5) | ||
| </script> | ||
|
|
||
| <template> | ||
| <!-- Animated paragraph skeleton --> | ||
| <N8nLoading :loading="loading" :rows="loadingRows" animated variant="p" /> | ||
|
|
||
| <!-- Static text skeleton without animation --> | ||
| <N8nLoading :class="$style.loading" :animated="false" variant="text" /> | ||
| </template> | ||
| ``` | ||
|
|
||
| **Multiple instances for list items:** | ||
| ```typescript | ||
| <script setup lang="ts"> | ||
| import { N8nLoading } from '@n8n/design-system' | ||
| </script> | ||
|
|
||
| <template> | ||
| <div class="list"> | ||
| <N8nLoading :rows="3" class="mb-xs" /> | ||
| <N8nLoading :rows="3" class="mb-xs" /> | ||
| <N8nLoading :rows="3" class="mb-xs" /> | ||
| </div> | ||
| </template> | ||
|
|
||
| <style> | ||
| .mb-xs { | ||
| margin-bottom: var(--spacing--xs); | ||
| } | ||
| </style> | ||
| ``` | ||
|
|
||
| **Conditional loading based on data availability:** | ||
| ```typescript | ||
| <script setup lang="ts"> | ||
| import { ref } from 'vue' | ||
| import { N8nLoading } from '@n8n/design-system' | ||
|
|
||
| const template = ref(null) | ||
| </script> | ||
|
|
||
| <template> | ||
| <div> | ||
| <!-- Show skeleton until data loads --> | ||
| <N8nLoading :loading="!template" :rows="1" variant="button" /> | ||
| <N8nLoading :loading="!template || !template.name" :rows="2" variant="h1" /> | ||
|
|
||
| <!-- Show actual content when loaded --> | ||
| <div v-if="template"> | ||
| <h1>{{ template.name }}</h1> | ||
| <p>{{ template.description }}</p> | ||
| </div> | ||
| </div> | ||
| </template> | ||
| ``` | ||
|
|
||
| **Column-based layout:** | ||
| ```typescript | ||
| <script setup lang="ts"> | ||
| import { N8nLoading } from '@n8n/design-system' | ||
| </script> | ||
|
|
||
| <template> | ||
| <!-- Renders 4 columns instead of rows --> | ||
| <N8nLoading :cols="4" variant="rect" /> | ||
| </template> | ||
| ``` | ||
|
|
||
| **Custom styling with CSS classes:** | ||
| ```typescript | ||
| <script setup lang="ts"> | ||
| import { N8nLoading } from '@n8n/design-system' | ||
| </script> | ||
|
|
||
| <template> | ||
| <N8nLoading :rows="3" class="custom-loader" /> | ||
| </template> | ||
|
|
||
| <style> | ||
| :global(.n8n-loading) div { | ||
| height: 32px; | ||
| width: 300px; | ||
| margin: 0; | ||
| } | ||
|
|
||
| :global(.n8n-loading) > div { | ||
| display: flex; | ||
| flex-direction: column; | ||
| gap: var(--spacing--2xs); | ||
| } | ||
| </style> | ||
| ``` | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Example claims column layout honors
variant, but the component ignoresvariantwhencolsis set, so the documented behavior cannot be achieved.Prompt for AI agents