In this quick tutorial, we will install and style the Popover component.
Install the component from your command line.
pnpm add akar
npm install akar
bun add akar
Import and structure the parts.
<!-- base-popover.vue -->
<script setup lang="ts">
import { APopoverArrow, APopoverClose, APopoverContent, APopoverPortal, APopoverRoot, APopoverTrigger } from 'akar'
</script>
<template>
<APopoverRoot>
<APopoverTrigger>More info</APopoverTrigger>
<APopoverPortal>
<APopoverContent>
Some more info...
<APopoverClose />
<APopoverArrow />
</APopoverContent>
</APopoverPortal>
</APopoverRoot>
</template>
Add styles where desired.
<template>
<APopoverRoot>
<APopoverTrigger class="APopoverTrigger">
More info
</APopoverTrigger>
<APopoverPortal>
<APopoverContent class="APopoverContent">
Some more info...
<APopoverClose />
<APopoverArrow class="APopoverArrow" />
</APopoverContent>
</APopoverPortal>
</APopoverRoot>
</template>
<style>
.APopoverTrigger {
background-color: white;
border-radius: 4px;
}
.APopoverContent {
border-radius: 4px;
padding: 20px;
width: 260px;
background-color: white;
}
.APopoverArrow {
background-color: white;
}
</style>
Here's a complete demo.
<script setup lang="ts">
import { APopoverContent, APopoverPortal, APopoverRoot, APopoverTrigger } from 'akar';
</script>
<template>
<APopoverRoot>
<APopoverTrigger
class="text-sm color-text p-1.5 rounded-md inline-flex ring ring-ring-accented ring-inset shadow-md transition-colors-280 items-center focus-visible:bg-background-elevated hover:bg-background-elevated"
>
<i class="i-lucide:info" />
</APopoverTrigger>
<APopoverPortal>
<APopoverContent
side="bottom"
:side-offset="5"
class="rounded-md bg-background pointer-events-auto ring ring-ring shadow-lg origin-$akar-popover-content-transform-origin focus:outline-none data-[state=closed]:(animate-out fade-out-0 zoom-out-95) data-[state=open]:(animate-in fade-in-0 zoom-in-95) data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2"
>
<CorePlaceholder class="m-4 inline-flex size-48" />
</APopoverContent>
</APopoverPortal>
</APopoverRoot>
</template>
The steps above outline briefly what's involved in using a Akar in your application.
These components are low-level enough to give you control over how you want to wrap them. You're free to introduce your own high-level API to better suit the needs of your team and product.
In a few simple steps, we've implemented a fully accessible Popover component, without having to worry about many of its complexities.
Akar documentation is optimized for Large Language Models (LLMs) to help you get AI-powered assistance while working with our components.
Our documentation includes a special LLM-friendly format that makes it easier for AI assistants to understand and provide accurate help with Akar components. This format:
You can access the LLM-optimized version of our documentation at llms.txt. This file contains:
When working with LLMs like ChatGPT, Claude, or other AI assistants, you can:
/llms.txt file for comprehensive context about AkarHere are some example prompts you can use with LLMs:
"Using the Akar documentation at https://akar.vinicunca.dev/llms.txt, help me implement a custom Dialog component with form validation."
"Based on the Akar llms.txt documentation, show me how to create an accessible Select component with custom styling."
"Refer to the Akar llms.txt file and explain how to properly implement keyboard navigation for a Combobox component."
By leveraging our LLM-optimized documentation, you can get more accurate and helpful responses from AI assistants when working with Akar components.