Skip to content

Commit

Permalink
docs: docs examples
Browse files Browse the repository at this point in the history
- Remove the calls to `{{yield}}`
  those seem to assume some more complex code structure
  that is not obvious from the README examples
- Give complete, working example using headless-ui
- I _think_ this makes a good,
  yet simple to follow starting point?
  • Loading branch information
MichalBryxi committed Nov 20, 2021
1 parent 8d2441a commit 93c6c1b
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,17 @@ Example building a `<Menu />` component
```hbs
<PopperJS as |reference popover|>
<button {{reference}} {{on "click" this.yourClickHandler}}>
{{yield to="trigger"}}
Trigger button
</button>
{{#if this.yourVisibilityIndicator}}
<div {{popover}}>
This is a popover!
{{yield to="default"}}
<button type="button">
Option 1
</button>
<button type="button">
Option 2
</button>
</div>
{{/if}}
</PopperJS>
Expand All @@ -56,15 +60,24 @@ and a menu popover may look like:
"
...attributes
>
{{yield menu to="trigger"}}
Trigger button
</menu.Button>
<menu.Items
{{popover}}
class="absolute top-2 z-20 grid mt-1 rounded-sm bg-white shadow-lg min-w-max"
as |items|
>
{{yield (component 'limber/menu/button' item=items.Item) to="options"}}
<items.Item as |item|>
<item.Element>
Option 1
</item.Element>
</items.Item>
<items.Item as |item|>
<item.Element>
Option 2
</item.Element>
</items.Item>
</menu.Items>
</PopperJS>
</Menu>
Expand Down

0 comments on commit 93c6c1b

Please sign in to comment.