# Enable users to define which node types can be selected when TypedInput's type is node

**URL:** <https://discourse.nodered.org/t/enable-users-to-define-which-node-types-can-be-selected-when-typedinputs-type-is-node/97413>\
**Category:** Feature Requests\
**Created:** [4 June 2025 14:11 UTC](https://discourse.nodered.org/t/enable-users-to-define-which-node-types-can-be-selected-when-typedinputs-type-is-node/97413 "2025-06-04T14:11:07Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![AllanOricil](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/allanoricil/32/106911_2.png) [@AllanOricil](https://discourse.nodered.org/u/AllanOricil)\
**Post date:** [4 June 2025 14:11 UTC](https://discourse.nodered.org/t/enable-users-to-define-which-node-types-can-be-selected-when-typedinputs-type-is-node/97413/1 "2025-06-04T14:11:07Z")

</div>

I have a use case where it is necessary to limit the node types that can be selected when TypedInput's type is node. To enable this, my proposal is to include of a new filter prop to typedInput that will be used to prevent users from selecting nodes that are not valid during the selection stage. When a node of a specific type isn't valid, it should not react on mouse events, like onhover or onclick

It can be an array containing the node types

```js
$(elm).typedInput({
    default: "node",
    types: ["node"],
    node: {
       filter: ["type-a", "type-b"]
    }
})

```

or a function that returns an array of node types

```js
$(elm).typedInput({
    default: "node",
    types: ["node"],
    node: {
       filter: () => ["type-a", "type-b"]
    }
})

```

---

<div class="post-metadata">

**Author:** ![GogoVega](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gogovega/32/71313_2.png) [@GogoVega](https://discourse.nodered.org/u/GogoVega)\
**Post date:** [4 June 2025 15:07 UTC](https://discourse.nodered.org/t/enable-users-to-define-which-node-types-can-be-selected-when-typedinputs-type-is-node/97413/2 "2025-06-04T15:07:52Z")

</div>

It can be done easily 😉

But with the following format:

```js
$(elm).typedInput({
    default: "node",
    types: ["node"],
    filter: (node) => ["type-a", "type-b"].includes(node.type)
})

```

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [4 June 2025 15:15 UTC](https://discourse.nodered.org/t/enable-users-to-define-which-node-types-can-be-selected-when-typedinputs-type-is-node/97413/3 "2025-06-04T15:15:33Z")

</div>

Not sure that's right. The `node` typedInput type doesn't support a filter option (not needed one). But would be reasonable to add. @AllanOricil please do raise a feature request issue on the repo so it doesn't got forgotten.

---

<div class="post-metadata">

**Author:** ![GogoVega](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gogovega/32/71313_2.png) [@GogoVega](https://discourse.nodered.org/u/GogoVega)\
**Post date:** [4 June 2025 15:25 UTC](https://discourse.nodered.org/t/enable-users-to-define-which-node-types-can-be-selected-when-typedinputs-type-is-node/97413/4 "2025-06-04T15:25:49Z")

</div>

I meant that it can be supported with that format.

@knolleary, if you accept the format, I can directly create the PR 🙂

---

<div class="post-metadata">

**Author:** ![AllanOricil](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/allanoricil/32/106911_2.png) [@AllanOricil](https://discourse.nodered.org/u/AllanOricil)\
**Post date:** [4 June 2025 15:38 UTC](https://discourse.nodered.org/t/enable-users-to-define-which-node-types-can-be-selected-when-typedinputs-type-is-node/97413/5 "2025-06-04T15:38:34Z")

</div>

I tried to open a feature in the repo but github sends me to this app

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [4 June 2025 15:40 UTC](https://discourse.nodered.org/t/enable-users-to-define-which-node-types-can-be-selected-when-typedinputs-type-is-node/97413/6 "2025-06-04T15:40:14Z")

</div>

The main issue here is we don't have any other examples where additional options are provided for one specific type (`node` in this case) - where the type is a built-in one specified by its name.

So we have to come up with an api design that works more generally.

I suspect that may be why @AllanOricil nested the option under a top level `node` property - to indicate these are additional options for the `node` type. I _think_ that makes sense to follow.

> I tried to open a feature in the repo but github sends me to this app

You can use the 'Blank Issue' option to raise an issue - and link back to this thread to show it has been discussed.

---

<div class="post-metadata">

**Author:** ![GogoVega](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gogovega/32/71313_2.png) [@GogoVega](https://discourse.nodered.org/u/GogoVega)\
**Post date:** [4 June 2025 15:52 UTC](https://discourse.nodered.org/t/enable-users-to-define-which-node-types-can-be-selected-when-typedinputs-type-is-node/97413/7 "2025-06-04T15:52:40Z")

</div>

Ok, to be more consistent the prototype will be:

```js
filter: string; // must be a node type
filter: string[]; // must be a list of node type
filter: (node) => boolean; // function

```

---

<div class="post-metadata">

**Author:** ![AllanOricil](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/allanoricil/32/106911_2.png) [@AllanOricil](https://discourse.nodered.org/u/AllanOricil)\
**Post date:** [4 June 2025 16:28 UTC](https://discourse.nodered.org/t/enable-users-to-define-which-node-types-can-be-selected-when-typedinputs-type-is-node/97413/8 "2025-06-04T16:28:38Z")

</div>

> [@knolleary](#):
>
> I suspect that may be why @AllanOricil nested the option under a top level `node` property - to indicate these are additional options for the `node` type. I _think_ that makes sense to follow.

That was the idea

> [@GogoVega](#):
>
> Ok, to be more consistent the prototype will be:
> 
> ```auto
> filter: string; // must be a node type
> filter: string[]; // must be a list of node type
> filter: (node) => boolean; // function
> 
> ```

I liked it

---

<div class="post-metadata">

**Author:** ![GogoVega](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gogovega/32/71313_2.png) [@GogoVega](https://discourse.nodered.org/u/GogoVega)\
**Post date:** [4 June 2025 16:45 UTC](https://discourse.nodered.org/t/enable-users-to-define-which-node-types-can-be-selected-when-typedinputs-type-is-node/97413/9 "2025-06-04T16:45:57Z")

</div>

> <https://github.com/node-red/node-red/pull/5154>
>
> \## Types of changes
> 
> \- \[\] Bugfix (non-breaking change which fixes an issue)
> …- \[x\] New feature (non-breaking change which adds functionality)
> 
> \## Proposed changes
> 
> Closes #5153.
> 
> Allows filtering selectable nodes with typedInput's \`node\` mode.
> 
> Prototypes are:
> \`\`\`ts
> filter: string; // node type
> filter: string\[\]; // list of node type
> filter: (node) =\> boolean; // function that returns a boolean
> \`\`\`
> 
> Example:
> \`\`\`js
> $(elm).typedInput({
> default: "node",
> types: \["node"\],
> node: {
> filter: "debug"
> //filter: \["debug", "inject"\]
> //filter: (node) =\> node.type === "debug"
> }
> })
> \`\`\`
> 
> \## Checklist
> 
> \- \[x\] I have read the \[contribution guidelines\](https://github.com/node-red/node-red/blob/master/CONTRIBUTING.md)
> \- \[x\] For non-bugfix PRs, I have discussed this change on the forum/slack team.
> \- \[x\] I have run \`npm run test\` to verify the unit tests pass
> \- \[\] I have added suitable unit tests to cover the new/changed functionality

---

<div class="post-metadata">

**Author:** ![AllanOricil](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/allanoricil/32/106911_2.png) [@AllanOricil](https://discourse.nodered.org/u/AllanOricil)\
**Post date:** [4 June 2025 16:52 UTC](https://discourse.nodered.org/t/enable-users-to-define-which-node-types-can-be-selected-when-typedinputs-type-is-node/97413/10 "2025-06-04T16:52:57Z")

</div>

You are fast @GogoVega !

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [3 August 2025 16:53 UTC](https://discourse.nodered.org/t/enable-users-to-define-which-node-types-can-be-selected-when-typedinputs-type-is-node/97413/11 "2025-08-03T16:53:03Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
