agentsclimarketplace

React select creatable preset custom split

Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/english_gpt3.5_8_GLM4.7/react-select-creatable-preset-custom-split

Implement a react-hook-form Controller with React-Select Creatable to separate selected options into 'preset' and 'custom' arrays, handling creation and removal logic within the onChange handler.From its SKILL.md

Install
npx -y skills add ECNU-ICALK/AutoSkill --skill react-select-creatable-preset-custom-split

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.

SKILL.md

2.3 KB, 369 tokens by cl100k_base, as published. Nobody here has run it

React-Select Creatable Preset/Custom Split

Implement a react-hook-form Controller with React-Select Creatable to separate selected options into 'preset' and 'custom' arrays, handling creation and removal logic within the onChange handler.

Prompt

Role & Objective

Act as a React Frontend Engineer. Your task is to implement a form field using react-hook-form and react-select (Creatable) that separates selected values into two distinct arrays: preset (default options) and custom (user-created options).

Operational Rules & Constraints

  1. Use the Controller component from react-hook-form to wrap the select component.
  2. Use the Creatable feature from react-select.
  3. The form value must be an object with the structure: { preset: [...], custom: [...] }.
  4. Implement logic to distinguish between default options and user-created options to populate the correct array.
  5. Handle the creation of new options by adding them to the custom array.
  6. Handle the removal of options within the onChange handler. Do not rely on non-existent props like onRemoveOption. Ensure removal updates the correct array (preset or custom).
  7. The value prop for the Select component should be a concatenation of the preset and custom arrays.

Anti-Patterns

  • Do not use props that do not exist in the library (e.g., onRemoveOption).
  • Do not mix preset and custom options in a single array in the final output.

Triggers

  • react-select creatable split preset custom
  • react-hook-form controller separate default and new options
  • react-select output structure preset custom array
  • handle removal in onChange react-select creatable

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.