Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Vanilla in Zag 1.0 #2309

Answered by segunadebayo
cschmatzler asked this question in Q&A
Discussion options

Heya! Do you plan on upgrading the examples for vanilla-ts to Zag 1.0 as well? As of now, it's broken since the package.json was bumped but the code itself still assumes machine-as-a-function.

You must be logged in to vote

I've got a quick PoC here for anyone interested in completing it
953476b

Replies: 4 comments 8 replies

Comment options

Would also love to see the vanilla examples updated :)

You must be logged in to vote
0 replies
Comment options

I have this in mind but didn't get to implement it. The vanilla setup will be close to the v0 external store implementation.

I will get to it when I have some free time.

You must be logged in to vote
4 replies
Comment options

Please do, I've been wrecking my head trying to get the zag machines for tooltip and others working with vanilla JS/TS. Annoyingly also, all AI tools such as ChatGPT really struggle and are absolutely useless at helping to get this working.

Even if you only showed us how to do it with one component so we can figure the rest of them out form would be perfect. Do you have a rough ETA on when you may have this ready for us?

Comment options

I've got a quick PoC here for anyone interested in completing it
953476b

Answer selected by segunadebayo
Comment options

Thank you, we will take a look tomorrow and see if we can get it working nicely for us. Much appreciated.

Comment options

There is this TS error:

Type '<T>(props: () => BindableParams<T>) => Bindable<T>' is missing the following properties from type 'BindableFn': cleanup, refts(2739)
types.ts(14, 3): The expected type comes from property 'bindable' which is declared here on type 'ContextParams<T>'
Comment options

The PoC is working great, thanks.
I noticed some bugfixes and changes recently and wondered if there plans to release it the vanilla code as its own package like @zag-js/vanilla?

You must be logged in to vote
0 replies
Comment options

The PoC has been great and much appreciated, however I've noticed that only enter animations work for components such as dialog. We really want a exit animation and from what I can tell means we need to utilise the https://zagjs.com/components/react/presence component.

We've attempted to use this but not getting anywhere with it, is this something you could get into your PoC to help us out?

You must be logged in to vote
4 replies
Comment options

Consider using @starting-style to style the transition from and to hidden.
https://developer.mozilla.org/en-US/docs/Web/CSS/@starting-style

Composing the presence and dialog machines might be a bit tricky

Comment options

Thanks, I've not heard of that one yet - will take a look. Shame it's only supported since 2024 though, but probably okay as entry animations work, exit ones just being snappy isn't the end of the world.

Comment options

I do wonder as well if the vanilla JS examples should really be custom elements (web components); given that they've been supported since 2016 and have a lot built into them (attribute monitoring, mount and unmount events) and can support custom events and more. 😉

Unfortunately I hadn't thought about using web components when we started building out our vanilla JS application, it's a little late in the day to change it; but might be an idea for a Zag JS implementation/framework. 😄

Comment options

FYI @starting-style is amazing and just simply works wonders. CSS is really starting to get good now! Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

AltStyle によって変換されたページ (->オリジナル) /