Spinner
The Spinner
component appears before a page or section is fully loaded, typically while awaiting an asynchronous data fetch or render cycle.
Examples
Spinners
Custom color via --agnostic-spinner-color
:
Usage
React
View source
import "agnostic-react/dist/common.min.css";
import "agnostic-react/dist/esm/index.css";
import { Spinner } from "agnostic-react";
export const YourComponent = () => (
<div>
<Spinner />
<Spinner size="small" />
<Spinner size="large" />
<Spinner size="xlarge" />
</div>
)
React: component source, storybook tests
Vue 3
View source
<script setup>
import "agnostic-vue/dist/common.min.css";
import "agnostic-vue/dist/index.css";
import { Spinner } from "agnostic-vue";
</script>
<template>
<Spinner />
<Spinner size="small" />
<Spinner size="large" />
<Spinner size="xlarge" />
</template>
Vue 3: component source, storybook tests
Svelte
View source
<script>
import 'agnostic-svelte/css/common.min.css';
import { Spinner } from "agnostic-svelte";
</script>
<div>
<Spinner />
<Spinner size="small" />
<Spinner size="large" />
<Spinner size="xlarge" />
</div>
Svelte: component source, storybook tests
Angular (Experimental)
View source
In your Angular configuration (likely angular.json
) ensure you're including the common AgnosticUI styles:
"styles": ["agnostic-angular/common.min.css"],
Add AgnosticUI's AgModule
module:
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AgModule } from 'agnostic-angular';
import { AppComponent } from './app.component';
@NgModule({
declarations: [AppComponent],
imports: [BrowserModule, AgModule],
providers: [],
bootstrap: [AppComponent],
})
export class AppModule {}
Now you can use in your components:
import { Component } from '@angular/core';
@Component({
selector: 'your-component',
template: `<div>
<ag-spinner></ag-spinner>
<ag-spinner size="small"></ag-spinner>
<ag-spinner size="large"></ag-spinner>
<ag-spinner size="xlarge"></ag-spinner>
</div>`
})
export class YourComponent {}
Angular: component source, storybook tests
Storybook
You can run the framework Storybooks and see live examples for React, Vue 3, Svelte, Astro, and Angular (experimental). The following will set up Storybook and run locally:
How to run Storybook
git clone git@github.com:AgnosticUI/agnosticui.git
cd agnosticui/<PACKAGE_NAME> && npm i # e.g. cd agnosticui/agnostic-react && npm i
npm run storybook
See Running Storybook.