Skip to content

How to style or add a className to a Widget component? #282

Discussion options

You must be logged in to vote

So the Widget component is mainly designed for quick prototyping. From the source you can see it barely even handles the input tag:

export const Widget = (props: {field: FieldHandler<widgets.CoreWidget>}) => {

The best thing to do is define your own Widget class like so:

import {
    FieldHandler
} from "@reactivated";

const Widget = ({field}: {field: FieldHandler}) => {
// Exhaustive case statement, see linked source above.
}

Note that FieldHandler is automatically generated and will force you to handle all widgets. Including custom ones you may have defined.

I hesitate to add a className prop to W…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
3 replies
@silviogutierrez
Comment options

@OnAnOpenField
Comment options

@silviogutierrez
Comment options

Answer selected by silviogutierrez
Comment options

You must be logged in to vote
1 reply
@silviogutierrez
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants