Reusable component with multiple form input fields

Hey Everyone, I’m trying to figure out how I can create a reusable component that I can use on multiple resources without having to type the same items over an over. I want to create a component called “Link” with the following fields.
Select::make(‘type),
TextInput::make(‘internal’),
Select::make(‘internal’),
TextInput::make(‘external’),
TextInput::make(‘email’),
TextInput::make(‘phone’),
Select::make(‘target’)
Select::make(‘type),
TextInput::make(‘internal’),
Select::make(‘internal’),
TextInput::make(‘external’),
TextInput::make(‘email’),
TextInput::make(‘phone’),
Select::make(‘target’)
4 Replies
toeknee
toeknee4mo ago
Put them wherever you want, and call them? Just add them as static functions and return them 🙂
dissto
dissto4mo ago
Check out Sharing fields between the resource form and wizards. Same logic can be applied to anything (not strictly tied to a wizard; like its shown)
ThatWebGuy
ThatWebGuyOP4mo ago
Thanks @toeknee . Any suggestions on how I can do a mutation on the data if it’s used? Similar to the above question, I’d like to only have to write the mutation once.
toeknee
toeknee4mo ago
Add a mutation function too and just call that where needed?
Want results from more Discord servers?
Add your server