MCPcopy Index your code
hub / github.com/ember-power-addons/ember-power-select-with-create

github.com/ember-power-addons/ember-power-select-with-create @v3.1.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v3.1.0 ↗ · + Follow
33 symbols 113 edges 29 files 0 documented · 0% 2 cross-repo links updated 8mo agov3.1.0 · 2025-11-07★ 5216 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

ember-power-select-with-create

Simple variation of ember-power-select that allows you to create a new entry based on the search text.

Installation

ember install ember-power-select-with-create

Compatibility

  • Ember.js v3.28 or above
  • Ember CLI v3.28 or above
  • Ember Power Select v8 or above

Please also refer to Ember Power Select documentation for it's compatibility notes.

Usage

<PowerSelectWithCreate
  @options={{countries}}
  @selected={{selectedCountry}}
  @onChange={{action (mut selectedCountry)}}
  @onCreate={{action "createCountry"}}
  as |country|
>
  {{country.name}}
</PowerSelectWithCreate>

If you want to be able to select multiple options, use the <PowerSelectWithCreate> component with parameter @multiple={{true}}.

For more options please refer to the Ember Power Select docs.

Control if create option should be shown

You can provide a callback showCreateWhen, which will be called whenever the user types into the search field. If you return true, the create option will be shown. If you return false, it won't be shown.

<PowerSelectWithCreate
  @options={{countries}}
  @searchField="name"
  @selected={{selectedCountry}}
  @onCreate={{action "createCountry"}}
  @showCreateWhen={{action "hideCreateOptionOnSameName"}}
  as |country|
>
  {{country.name}}
</PowerSelectWithCreate>
import Component from '@ember/component';
import { action } from '@ember/object';

export default class MyComponent extends Component {
  @action
  hideCreateOptionOnSameName(term) {
    let existingOption = this.countries.find(({ name }) => name === term);
    return !existingOption;
  }
}

Control create option position

You can provide showCreatePosition property to control the position(bottom|top) of create option. It should be either "top" or "bottom". It defaults to "top".

<PowerSelectWithCreate
  @options={{countries}}
  @searchField="name"
  @selected={{selectedCountry}}
  @onCreate={{action "createCountry"}}
  @showCreatePosition="bottom"
  @showCreateWhen={{action "hideCreateOptionOnSameName"}}
  as |country|
>
  {{country.name}}
</PowerSelectWithCreate>

Control the create option's label - Default Add "{{option}}"...

You can provide the buildSuggestion action to control the label of the create option. Default - Add "{{option}}"...

<PowerSelectWithCreate
  @options={{countries}}
  @searchField="name"
  @selected={{selectedCountry}}
  @onCreate={{action "createCountry"}}
  @buildSuggestion={{action "customSuggestion"}}
>
  {{country.name}}
</PowerSelectWithCreate>
import Component from '@ember/component';
import { action } from '@ember/object';

export default class MyComponent extends Component {
  @action
  customSuggestion(term) {
    return `Create ${term}`;
  }
}

Pass the creation option to a component for more control

Beyond building the suggestion label, you can pass the suggestedOptionComponent property, which should be a component, not a string to be embroider compatible.

This component will receive the suggestedOption itself as option and the current term as term.

<PowerSelectWithCreate
  @options={{countries}}
  @searchField="name"
  @selected={{selectedCountry}}
  @onCreate={{action "createCountry"}}
  @suggestedOptionComponent={{component (ensure-safe-component "suggested-option")}}
>
  {{country.name}}
</PowerSelectWithCreate>

<span class="is-suggested">
  Add "{{term}}"...
</span>

Demo

https://ember-power-select-with-create.pagefrontapp.com/

Core symbols most depended-on inside this repo

filter
called by 5
ember-power-select-with-create/src/components/power-select-with-create.js
setupRenderingTest
called by 4
test-app/tests/helpers/index.js
createSlowPromise
called by 2
test-app/app/controllers/application.js
addCreateOption
called by 2
ember-power-select-with-create/src/components/power-select-with-create.js
buildSuggestionForTerm
called by 2
ember-power-select-with-create/src/components/power-select-with-create.js
shouldShowCreateOption
called by 1
ember-power-select-with-create/src/components/power-select-with-create.js
buildSuggestionLabel
called by 1
ember-power-select-with-create/src/components/power-select-with-create.js
constructor
called by 0
test-app/app/controllers/application.js

Shape

Method 18
Class 12
Function 3

Languages

TypeScript100%

Modules by API surface

ember-power-select-with-create/src/components/power-select-with-create.js12 symbols
test-app/app/controllers/application.js8 symbols
ember-power-select-with-create/src/components/power-select-multiple-with-create.js4 symbols
test-app/tests/helpers/index.js3 symbols
test-app/app/router.js2 symbols
test-app/app/models/country.js2 symbols
test-app/app/app.js2 symbols

Used by 2 indexed graphs manifest dependencies, hub-wide

For agents

$ claude mcp add ember-power-select-with-create \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page