How to remove default inline styles from page?

Builder content link

Builder public api key

What are you trying to accomplish
Builder seems to be applying some default styles to the .builder-component element and I can’t figure out why or how to remove them. This is only happening for some pages.

Screenshots or video link

Code stack you are integrating Builder with

Reproducible code example

Digging more here we’ve discovered that this issue is isolated to unpublished content.

Hi there,

Thank you for reaching out to support!

Builder adds default styles for the purpose of making building out elements easier for our customers, however, some prefer to build it out themselves. For this, we have a setting, if you go into Settings > Advanced settings > Editor, you can toggle off the Use default styles.

One thing strange we’ve noticed is that on your unpublished pages, it’s flashing 404 error before the previewed unpublished content is loaded. I would take a look inside your code file to see what is firing which is causing the 404 component to load (and hence the 404 CSS is being injected inline). Loom | Free Screen & Video Recording Software | Loom

If you’d like, please send us the code file and we can also take a look at your file to see how it looks!

My understanding is that the ‘Use default styles’ setting is a global setting. I wouldn’t expect my pages to differ in behavior here when changing a global setting. Is my understanding correct that the setting is global and not scoped to page models?

This is a fun one! The injected styles are coming from Next’s default error page.

Presumably React is reusing the div instead of replacing with the clean Builder component. I’ll go ahead and explore adding key=“something-unique” to try and resolve. Thanks for digging!

Any insight into why we’re seeing a 404 for preview unpublished in the first place? Here is our component render:

return (
      {router.isFallback ? (
            display: 'flex',
            alignItems: 'center',
            justifyContent: 'center',
            marginTop: '5rem',
          <LogoLoader />
      ) : page || Builder.isEditing || Builder.isPreviewing ? (
        <BuilderComponent model={MODEL_NAME} content={page} />
      ) : (
            <meta name="robots" content="noindex" />
          <DefaultErrorPage statusCode={404} />

Hmm, it could be because of the conditionals being set within your render.

Here’s an example of the component render on my end, where I have the conditionals outside of the render

export default function Page({ page }) {
  const router = useRouter();
    This flag indicates if you are viewing the page in the Builder editor.
  const isPreviewing = useIsPreviewing();

  if (router.isFallback) {
    return <h1>Loading...</h1>;

    Add your error page here. This will happen if there are no matching
    content entries published in Builder.
  if (!page && !isPreviewing) {
    return <DefaultErrorPage statusCode={404} />;

  return (
        {/* Add any relevant SEO metadata or open graph tags here */}
        <meta name="description" content={page?.data.descripton} />
      <div style={{ padding: 50, textAlign: 'center' }}>
        {/* Put your header or main layout here */}
        Your header 88asdf

      {/* Render the Builder page */}
      <BuilderComponent model="page" content={page} />

      <div style={{ padding: 50, textAlign: 'center' }}>
        {/* Put your footer or main layout here */}
        Your footer