> ## Documentation Index
> Fetch the complete documentation index at: https://docs.velure.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Admin Layout

> AdminLayout.vue Component Documentation

The `AdminLayout.vue` component provides a structured layout for admin pages, integrating essential elements like navigation, branding, and user interactions. It includes slots for customizable sections, ensuring flexibility while maintaining consistency across admin pages.

## Features

<CardGroup cols={2}>
  <Card title="Logo Section" icon="square-1">
    Includes a dedicated area for displaying your logo.
  </Card>

  <Card title="Top Navigation" icon="square-2">
    Provides top navigation elements for easy access to key features.
  </Card>

  <Card title="Sidebar Menu" icon="square-3">
    Features a sidebar navigation menu for structured navigation.
  </Card>

  <Card title="Customizable Content" icon="square-4">
    Offers a flexible main content area to suit your needs.
  </Card>

  <Card title="Extensible Slots" icon="square-5">
    Allows customization and extension through default slots.
  </Card>
</CardGroup>

***

## Usage

Here's an example of how to use the `AdminLayout` component:

```js theme={null}
import { Head, Link, router } from '@inertiajs/vue3';
import { AdminLayout, Avatar, SidebarLink, SidebarTitle} from '@robojuice/velure-ui';
```

```vue theme={null}
<AdminLayout>
    <Head :title="title" />

    <template #logo>
        <Link :href="route('dashboard')">
            <!-- Logo -->
        </Link>
    </template>

    <template #nav-top-left-first>
        <div></div>
    </template>

    <template #nav-top-left-last>
        <Link :href="route('profile.show')" class="button-center-content flex-shrink-0">
            <Avatar
                :image="$page.props.auth.user.profile_photo_url || ''"
                :alt="$page.props.auth.user.name"
                :monogram="`${$page.props.auth.user.name.charAt(0)}`"
            />
            <strong>{{ $page.props.auth.user.name }}</strong>
        </Link>
    </template>

    <template #nav-side>
        <SidebarLink :href="route('dashboard')" :is-active="['Dashboard'].includes($page.component)">
            <template #icon><IconHome :fill="['Dashboard'].includes($page.component)" size="20" /></template>
            Home
        </SidebarLink>
        <SidebarTitle>Account</SidebarTitle>
        <SidebarLink :href="route('profile.show')" :is-active="['Profile/Show'].includes($page.component)">
            <template #icon><IconUser :fill="['Profile/Show'].includes($page.component)" size="20" /></template>
            Profile
        </SidebarLink>
    </template>

    <div class="p-2">
        <slot />
    </div>
</AdminLayout>
```

***

## Slots

<ParamField path="logo" type="slot">
  Slot for the logo, typically displayed at the top of the sidebar. `<template #logo></template>`
</ParamField>

<ParamField path="nav-top-left-first" type="slot">
  Slot for additional content or controls in the top-left navigation area (first position). `<template #nav-top-left-first></template>`
</ParamField>

<ParamField path="nav-top-left-last" type="slot">
  Slot for user-related elements (e.g., avatar, name) in the top-left navigation area (last position). `<template #nav-top-left-last></template>`
</ParamField>

<ParamField path="nav-side" type="slot">
  Slot for sidebar navigation links and titles. This is the primary navigation area. `<template #nav-side></template>`
</ParamField>

<ParamField path="default" type="slot">
  Slot for the main page content.
</ParamField>

***

## Example Implementations

### Adding a Logo

```vue theme={null}
<template #logo>
    <Link :href="route('dashboard')">
        <ApplicationMark class="block h-9 w-auto" />
    </Link>
</template>
```

### Top Navigation with User Info

```vue theme={null}
<template #nav-top-left-last>
    <Link :href="route('profile.show')" class="button-center-content flex-shrink-0">
        <Avatar
            :image="$page.props.auth.user.profile_photo_url || ''"
            :alt="$page.props.auth.user.name"
            :monogram="`${$page.props.auth.user.name.charAt(0)}`"
        />
        <strong>{{ $page.props.auth.user.name }}</strong>
    </Link>
</template>
```

### Sidebar with Navigation Links

```vue theme={null}
<template #nav-side>
    <SidebarLink :href="route('dashboard')" :is-active="['Dashboard'].includes($page.component)">
        <template #icon><IconHome :fill="['Dashboard'].includes($page.component)" size="20" /></template>
        Home
    </SidebarLink>
    <SidebarTitle>Account</SidebarTitle>
    <SidebarLink :href="route('profile.show')" :is-active="['Profile/Show'].includes($page.component)">
        <template #icon><IconUser :fill="['Profile/Show'].includes($page.component)" size="20" /></template>
        Profile
    </SidebarLink>
</template>
```

### Logout Button

```vue theme={null}
<template #nav-side>
    <form class="mt-8" @submit.prevent="logout">
        <Button kind="text">
            <span>Log out</span><IconArrowRightUp size="12" />
        </Button>
    </form>
</template>
```
