-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9b50246
commit 544ea31
Showing
3 changed files
with
179 additions
and
53 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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,114 @@ | ||
# Popover | ||
|
||
`Popover` is a non-modal dialog that is positioned near its disclosure. It is commonly used for displaying additional related content. | ||
|
||
## Installation | ||
|
||
```bash | ||
npm i vue-ari | ||
``` | ||
|
||
or | ||
|
||
```bash | ||
yarn add vue-ari | ||
``` | ||
|
||
## Usage | ||
|
||
```vue | ||
<template> | ||
<PopoverDisclosure v-bind="popover"> | ||
Open Popover | ||
</PopoverDisclosure> | ||
<Popover v-bind="popover"> | ||
Popover Content | ||
</Popover> | ||
</template> | ||
<script> | ||
import { Popover, PopoverDisclosure, usePopoverState } from 'vue-ari' | ||
export default { | ||
name: 'AppButton', | ||
components: { | ||
Popover, | ||
PopoverDisclosure, | ||
}, | ||
setup() { | ||
const popover = usePopoverState() | ||
return { | ||
popover, | ||
} | ||
}, | ||
} | ||
</script> | ||
``` | ||
|
||
## Styling | ||
|
||
Ari components don't include styling by default. This gives you the ability to add styles however you like. | ||
|
||
### Example Using Tailwind | ||
|
||
```vue | ||
<template> | ||
<PopoverDisclosure | ||
v-bind="popover" | ||
class="text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline" | ||
> | ||
Open Popover | ||
</PopoverDisclosure> | ||
<Popover | ||
v-bind="popover" | ||
class="rounded shadow-lg border border-solid border-gray-300 py-3 px-5 bg-white" | ||
> | ||
Popover Content | ||
</Popover> | ||
</template> | ||
<script> | ||
import { Popover, PopoverDisclosure, usePopoverState } from 'vue-ari' | ||
export default { | ||
name: 'App', | ||
components: { | ||
Popover, | ||
PopoverDisclosure, | ||
}, | ||
setup() { | ||
const popover = usePopoverState() | ||
return { | ||
popover, | ||
} | ||
}, | ||
} | ||
</script> | ||
``` | ||
|
||
## Reusable Components | ||
|
||
It would get pretty verbose to add the same styling classes wherever you like to use a `Popover`. So the recommended way is wrapping Ari components inside your own base components and use them inside your app. | ||
|
||
```vue | ||
<template> | ||
<PopoverDisclosure | ||
v-bind="$props" | ||
class="text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline" | ||
> | ||
<slot /> | ||
</PopoverDisclosure> | ||
</template> | ||
<script> | ||
import { PopoverDisclosure, popoverDisclosureProps } from 'vue-ari' | ||
export default { | ||
name: 'AppPopoverDisclosure', | ||
props: popoverDisclosureProps, | ||
components: { | ||
PopoverDisclosure, | ||
}, | ||
} | ||
</script> | ||
``` |