A powerful tool that adds select type inputs to your strapi with the ability to dynamically load options via API. Supports static and searchable endpoints—autocomplete.
🎉 Supports Strapi 4 and Strapi 5 🎉
A powerful tool that adds select type inputs to your strapi with the ability to dynamically load options via API. Supports static and searchable endpoints—autocomplete. This module adds two inputs:
Remote select, allow selecting one or several values from the remote options endpoint. Searchable select, allow selecting one or several values from the searchable remote endpoint.
Features (all selects support remote options loading):
Too often I've had situations where I need to allow selecting one or more values from a list that is available as an API. Simply transferring the value is not an option, as the values can change dynamically on the remote resource, and the native Select has the same value as the one displayed to the user, which is not always convenient. That's why I was inspired to create this module, which solves this problem, you just need to add the desired input and configure it and that's it, you will always get the latest options, and the ability to use the searchable API or auto-complete significantly expands the use cases for this module.
Strapi version | Requirements |
---|---|
Strapi 5 | "node": ">=18.0.0 <=20.x.x" "@strapi/strapi": "^5.2.0" |
Strapi 4 | "node": ">=18.0.0 <=20.x.x" "@strapi/strapi": "^4.24.5" |
This plugin supports several strapi versions, use this table to choose the correct one for your strapi version
Strapi 4 | Strapi 5 |
---|---|
1.x.x | 2.x.x |
# using yarn
yarn add strapi-plugin-remote-select
# using npm
npm install strapi-plugin-remote-select --save
Enable plugin in your config/plugins.js
file, just add:
1module.exports = {
2 'remote-select': {
3 enabled: true,
4 },
5};
Each input select that this plugin adds has a similar configuration:
Module is using JSON path for allow configurable way to get an option array, label, and value for options objects. Learn more about JSON path here
Field name | Type | Description |
---|---|---|
Fetch options url | string | A url for fetch options for select. Endpoint should return a valid json string as response |
Fetch options method | string | HTTP method for requesting options. Default: GET |
Fetch options request body | string | HTTP body for requesting options. Provide a your custom body for options fetching. |
Fetch options request custom headers | string | Custom fetch options request headers in raw format, one header per line. For example: Content-type: application/json |
JSON path to options array | string | $ - here it is the body answer to the options request |
JSON path to label for each item object | string | $ - here it is the each options item selected from "JSON path to options array" |
JSON path to value for each item object | string | $ - here it is the each options item selected from "JSON path to options array" |
Advanced settings:
Field name | Type | Description |
---|---|---|
Default value | string | |
Multi mode | string | |
Private field | string |
Depends on multi
option you will have in the model a single string from selected value
option or array of selected value
string.
Basic configuration window:
for example, let's consider the next api endpoint 'https://dummyjson.com/products' with response structure:
1{
2 "products": [
3 {
4 "id": 1,
5 "title": "Essence Mascara Lash Princess",
6 "description": "The Essence Mascara Lash Princess is a popular mascara known for its volumizing and lengthening effects. Achieve dramatic lashes with this long-lasting and cruelty-free formula.",
7 "category": "beauty",
8 "price": 9.99,
9 "discountPercentage": 7.17,
10 "rating": 4.94,
11 "stock": 5
12 },
13 {
14 "id": 2,
15 "title": "Eyeshadow Palette with Mirror",
16 "description": "The Eyeshadow Palette with Mirror offers a versatile range of eyeshadow shades for creating stunning eye looks. With a built-in mirror, it's convenient for on-the-go makeup application.",
17 "category": "beauty",
18 "price": 19.99,
19 "discountPercentage": 5.5,
20 "rating": 3.28,
21 "stock": 44
22 },
23 ...
24 ]
25}
Configured remote select window will look like that:
We are going to use id
field from a product object as value and title
field as label
and as a result, we have: (single mode)
multiple mode:
Depends on multi
option you will have in the model a JSON string with the object:
1{
2 "label": "Label from option",
3 "value": "Value from option"
4}
or JSON string with the array of objects:
1[
2 {
3 "label": "Label from option",
4 "value": "Value from option"
5 },
6 {
7 "label": "Label from option",
8 "value": "Value from option"
9 }
10]
Basic configuration window: It's the same as in Remote select input:
for example, let's consider the next api endpoint with search ability 'https://dummyjson.com/products/search?q=searchphrase' with the same response structure like as in Remote select example.
Configured remote select window will look like that:
and as a result, we have: (single mode)
multiple mode:
npm install strapi-plugin-remote-select
Check out the available plugin resources that will help you to develop your plugin or provider and get it listed on the marketplace.