#Styles api in variant?

10 messages · Page 1 of 1 (latest)

silver steeple
#

Can't we use styles API when creating variants?
for example, I want to create shadowInput and I want to customize the input element that is in stylesApi .

     <TextInput
            styles={(theme) => ({
              input: {
                boxShadow: "inset 0px 0px 6px 2px rgba(0, 0, 0, 0.2)",
              },
            })}
          /> 

//Mantine theme variant
   TextInput: {
                variants: {
                  shadowIn: (theme) => ({
                    input: {
                      boxShadow: "inset 0px 0px 6px 2px rgba(0, 0, 0, 0.2)",
                    },
                  }),
                },
              },
#

this is the style after applying variant shadowIn . as you can see the styles are overriding the borders are changed and not getting default styles

#

Ok now I see the problem that we have to. We can use styles api in variant but we have to style every element from scratch.isn't there any way that we can extend previous variant style in to new one?
Eg

shadowIn:{
...variant.filled,
Input:{...}
}
old estuary
silver steeple
silver steeple
# old estuary no

ok . is it possible make function or hook to get the styles of component it woud be helpful to extend them in vraiants

the function params will b like this useGetComponentStyles(Component,variant:optional)

varaint will be that is default to theme

old estuary
silver steeple
old estuary