If you have Webpack, it's also possible to use it. Some of the ideas we're exploring inside of probably the later versions of V1 would be a zero-runtime build. And what this would allow for is that we would walk through your entire template context because we realized most of our users are using Chakra UI to define maybe static properties, static style props onto the components. And so, what we can also do is that we can walk through the entire your template and we can then extract those style props into CSS that we'll then inject into your single file component styles.
We're also planning to, in the future, we're also planning to use state machines for logic heavy components. For example, the accordion has a lot of logic that we have to compute and a lot of states that we have to manage. And the best way to deal with this that we discovered as a team was to use state machines. And for this, what this allows us to do is that the state machine only returns the current state that we then destructure into the components that are then rendered on the page. So this makes it a lot more convenient to use, and it's certainly a good way for us to share logic. And so, in the future, if somebody decides to build ChakraUI for Svelte, they don't have to rewrite all this logic and use side effects for things that would probably already exist inside a state machine, they just need to access that state and then provide it to their components, which is really, really convenient.
So what's coming inside of the V1 theming API? As I mentioned before, we're going to be providing component overrides, which we'll then look at today. We're also providing a custom variants API. We're also providing the ability to create custom sizes for your components. We're also providing the factory function API and custom components. So for today's talk, I want to focus on three attributes that the theming API will cover inside of V1. The one, among so many, by the way, since we're going to have some time, we can only talk about three of them. The first one will be component overrides. So inside of the theme object, for those of us that are quite familiar with the V1, of V0.x of chakray y, within the plugin options, there's a value called extend theme. And on the extend theme, for V1 we've added a key called the components key. So this component key allows you to now override the base styles for the component that you are then choosing to override within the extend theme. So when you define the base styles, those styles get applied to all the buttons. So you don't need to create a custom button so it can do that. The second thing we have allowed for you to do is to define custom variants. So now within Chakra UI, you can then create a custom variant within for that component that you are, are hoping to consume the variant. And finally, you can then define custom sizes, which is really convenient for creating an extra large button. If you need a button that's 100 meters wide, you can certainly now do that with Chakra UI view, I wouldn't advise you creating a 100 meter wide button, it wouldn't fit on the screen. But it's certainly possible.
So let's look at all of this in action, what's going to, how we're going to implement this, this, how we're going to see these things in action. So for starters, I went online and I tried to collect you know, a bit of a user interface with a few custom, which has components that are not implemented inside of, whose designs are not implemented inside of Chakra UI. So looking very quickly at this, this UI, I can see there's a button here and this button appears to have a different theme compared to the default styles that are provided inside of Chakra UI.
Comments