Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions docs/app/components/snippets/installation-2.js.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import config from './config/environment'; // this line should already be present
import { setConfig } from 'ember-basic-dropdown/config';

// Basic usage:
setConfig({
rootElement: config.APP.rootElement, // Default is 'body' (or '#ember-testing' in tests)
});

// Advanced: If you need to override globally the destination element ID (BasicDropdownWormhole), you can do:
setConfig({
destination: 'my-custom-destination-id',
rootElement: config.APP.rootElement, // Default is 'body' (or '#ember-testing' in tests)
});
25 changes: 13 additions & 12 deletions docs/app/templates/public-pages/docs/installation.gts
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,31 @@ import { LinkTo } from '@ember/routing';
<h1 class="doc-page-title">Installation</h1>

<p>
Ember-basic-dropdown is distributed as an
<a href="https://www.ember-cli.com/">Ember CLI</a>
addon. To install it, run the following command in your ember project
directory
To install ember-basic-dropdown, run the following command in your ember
project directory
</p>

<p>
<div class="code-block">
<pre>$ ember install ember-basic-dropdown</pre>
<pre>$ pnpm install ember-basic-dropdown</pre>
</div>
</p>

<p>
When installing this through
<code>ember install</code>
the addon will add the necessary snippet above automatically in your app.
After the installation you need to add the following lines somewhere in your
<code>app.js/ts</code>.
</p>

<h3>Manual installation</h3>
<CodeExample
@js="installation-2.js.txt"
@showResult={{false}}
@activeTab="js"
/>

<p>
After the installation you need to add the following lines somewhere in your
templates where you want to render the dropdown content into e.g. your
<code>application.hbs</code>. In this component will be rendered the
Then you need to add the following lines somewhere in your templates where
you want to render the dropdown content into e.g. your
<code>application.gjs/gts</code>. In this component will be rendered the
dropdown content.
</p>

Expand Down
5 changes: 3 additions & 2 deletions ember-basic-dropdown/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ It is intended to be a building block for more complex components but is perfect
### Installation

```
ember install ember-basic-dropdown
pnpm install ember-basic-dropdown
```

For more installation details see [documentation](https://ember-basic-dropdown.com/docs/installation)
Expand Down Expand Up @@ -111,12 +111,13 @@ If you'd like the dropdown to close itself after a user clicks on it, you can us

```glimmer-ts
import BasicDropdown from 'ember-basic-dropdown/components/basic-dropdown';
import { on } from '@ember/modifier';

<template>
<BasicDropdown as |dd|>
<dd.Trigger>Click me!</dd.Trigger>
<dd.Content>
<div {{action dd.actions.close}}>
<div role="button" {{on "click" dd.actions.close}}>
{{yield dd}}
</div>
</dd.Content>
Expand Down