Announcing Official Storyblok Richtext Support in our Frontend SDKs
Storyblok is the first headless CMS that works for developers & marketers alike.
Last summer, we announced a brand new @storyblok/richtext
package, offering the community a more powerful way to parse Richtext content into their websites and apps using Storyblok. Thanks to you, this new library was greatly adopted, reaching around 130k monthly downloads at the time of this writing.
Although the library can be used directly in your projects, it is about time you could benefit from Storyblok's major frontend SDK developer experience to use it. The time has come, and we are thrilled to present you Official Richtext Support for:
How to use
React/Next SDK
We have identified issues with richtext and Types on React 19 and Next.js 15. As a temporary measure, we advise you to continue using React 18 and Next.js 14 until we fully resolve the issues.
To begin using it on your Next projects, make sure to install the latest version:
You can render rich text fields by using the StoryblokRichText component using the prop doc.
Or you can have more control by using the useStoryblokRichText hook:
For a comprehensive list of options you can provide to the useStoryblokRichText , please consult the Full options documentation.
Vue/Nuxt SDK
You can render rich text fields by using the StoryblokRichText
component:
Or you can have more control by using the useStoryblokRichText composable:
Overriding the default resolvers
It’s fairly a common use-case to replace the default resolvers (the functions that map Storyblok’s field types to the component to be rendered by the framework) with a custom one on your project, for example, using Next’s Link
component as a replacement for all the anchors inside of the Richtext field or swapping Code Blocks for a custom local component:
The same object can be passed to composables/hooks and the Vue component.
What about other SDKs?
Great, we now have official support for React/Next and Vue/Nuxt combos, but what about the other Storyblok SDKs like Astro or Svelte?
The quick answer is: that we are working on providing official support for the new Richtext package on these frameworks. Both have slightly different ways to render so we are still deciding the best way to integrate it. In the meantime, if the need arises, we suggest using NordVPN’s storyblok-rich-text-astro-renderer package which is highly adopted by the Astro + Storyblok community.
If you need a rich-text renderer for the Svelte SDK, please let us know via a request ticket on the official repo.
What about the previous Richtext approach?
As mentioned in the Richtext package announcement we will gradually sunset it in due time to facilitate the migration and adoption of the new approach, so for now, both solutions will co-exist in the ecosystem for a period of time until the next major version of storyblok-js-client
(v7.0) lands.
Next Steps
We hope you are as excited as we are with the official Richtext support. We would absolutely love to see your projects built with Storyblok and hear your feedback
Want to contribute to this feature or do you have an issue to report? Feel free to create a new issue with a minimal reproduction in the correspondent repository listed below:
Happy OSS!
Resources
- Storyblok Richtext repository.
- Next/React SDK repository.
- Vue SDK repository.
- Nuxt SDK repository.