joystick
joystick copied to clipboard
Add a formDefaults field to component options
Have a way to autopopulate a form based on name fields using a defaults object on the component.
Forgot about this. Would be really helpful for testing in development.
Shouldn't be too hard to do. Just provide a map like this:
import joystick from '@joystick.js/ui';
joystick.component({
// NOTE: Showing a function example because this could be helpful beyond development (e.g., a profile page).
formDefaults: () => {}
formDefaults: {
firstName: 'Doug',
lastName: 'Funnie',
},
render: () => {
return `
<input type="text" name="firstName" />
<input type="text" name="lastName" />
`;
},
});