@alihbuzaid/ember-ui
Version:
Fleetbase UI provides all the interface components, helpers, services and utilities for building a Fleetbase extension into the Console.
68 lines (50 loc) • 3.83 kB
Markdown
# Basic Dropdown Component
This is a customizable Basic Dropdown component built with Ember.js. It provides a UI element that allows users to select an item from a dropdown list. The dropdown can be triggered by clicking on a button or by hovering over an area.
## Usage
To use the Basic Dropdown component, you can simply import it into your Ember component and include it in your template as follows:
```hbs
<BasicDropdown class={{}} ={{}} ={{}} ={{}} ={{}} ={{}} ={{}} ={{}} ={{}} ={{}} as |dd|>
<dd.Trigger class={{}}>
{{#if }}
{{component buttonComponentArgs=this.buttonComponentArgs text= class=(concat (if dd.isOpen ' dd-is-open')) wrapperClass= type=this.type active= size=this.buttonSize isLoading= disabled= textClass= helpText= tooltipPlacement= img= imgClass= alt=}}
{{else}}
<Button title={{}} class="{{@buttonClass}} {{if dd.isOpen 'dd-is-open'}}" ={{}} ={{this.type}} ={{}} ={{this.buttonSize}} ={{}} disabled={{}} ...attributes>
{{#if }}
<FaIcon ={{}} ={{}} ={{}} class="{{@iconClass}} {{if @text 'mr-2'}}" />
{{/if}}
{{#if }}
<img src={{}} class={{}} alt={{or "image"}} />
{{/if}}
{{#if }}
<Attach::Tooltip ="clean" ="scale" ={{or "top" }}>
<InputInfo ={{}} />
</Attach::Tooltip>
{{/if}}
<div class="{{@textClass}} truncate">
{{}}
</div>
</Button>
{{/if}}
</dd.Trigger>
<dd.Content class={{}} ={{}}>
{{yield dd}}
</dd.Content>
</BasicDropdown>
```
You can customize the Basic Dropdown component by passing in different props:
| Parameter | Description |
|--------------------|---------------------------------------------------------------------------------|
| `wrapperClass` | The class to be applied to the wrapper element of the dropdown. |
| `renderInPlace` | Whether to render the dropdown in place or append it to the document body. |
| `registerAPI` | A callback function that will receive the API object of the dropdown. |
| `horizontalPosition` | The horizontal position of the dropdown relative to the trigger element. |
| `verticalPosition` | The vertical position of the dropdown relative to the trigger element. |
| `calculatePosition` | A function that calculates the position of the dropdown. |
| `defaultClass` | The default class to be applied to the dropdown. |
| `matchTriggerWidth` | Whether to match the width of the dropdown to the width of the trigger element. |
| `onOpen` | A callback function that will be called when the dropdown is opened. |
| `onClose` | A callback function that will be called when the dropdown is closed. |
## Example
```hbs
<BasicDropdown ="Dropdown" ="btn
```