---
layout: ~/layouts/MdxDocLayout.astro
title: "Loader"
description: "A loading spinner to indicate loading state."
sourceFile: "components/loader"
---

import ComponentExample from "~/components/docs/ComponentExample.astro";
import ComponentSection from "~/components/docs/ComponentSection.astro";
import CodeBlock from "~/components/docs/CodeBlock.astro";
import Heading from "~/components/docs/Heading.astro";
import PropsTable from "~/components/docs/PropsTable.astro";
import {
  LoaderBasicDemo,
  LoaderSizesDemo,
  LoaderCustomSizeDemo,
} from "~/components/demos/LoaderDemo";

{/* Demo */}

<ComponentSection>
  <ComponentExample code={`<Loader />`}>
    <LoaderBasicDemo client:visible />
  </ComponentExample>
</ComponentSection>

{/* Installation */}

<ComponentSection>
  <Heading level={2}>Installation</Heading>
  <Heading level={3}>Barrel</Heading>
  <CodeBlock code={`import { Loader } from "@cloudflare/kumo";`} lang="tsx" />
  <Heading level={3}>Granular</Heading>
  <CodeBlock
    code={`import { Loader } from "@cloudflare/kumo/components/loader";`}
    lang="tsx"
  />
</ComponentSection>

{/* Usage */}

  <ComponentSection>
    <Heading level={2}>Usage</Heading>
    <CodeBlock
      code={`import { Loader } from "@cloudflare/kumo";

export default function Example() {
  return <Loader />;
}`}
      lang="tsx"
    />
  </ComponentSection>

{/* Examples */}

  <ComponentSection>
    <Heading level={2}>Examples</Heading>

    <Heading level={3}>Default Size</Heading>
    <ComponentExample code={`<Loader />`}>
      <LoaderBasicDemo client:visible />
    </ComponentExample>

    <Heading level={3}>Custom Size</Heading>
    <ComponentExample code={`<Loader size={24} />`}>
      <LoaderCustomSizeDemo client:visible />
    </ComponentExample>

  </ComponentSection>

{/* API Reference */}

<ComponentSection>
  <Heading level={2}>API Reference</Heading>
  <PropsTable component="Loader" />
</ComponentSection>
