How to Add a Logo to Sanity Studio

9 replies
Last updated: Sep 15, 2023
How do I add a logo for my sanity studio?
AI Update

You can add a custom logo to your Sanity Studio by using the icon property in your workspace configuration. This is the modern approach in Sanity Studio v3 (specifically since v3.23.0).

In your sanity.config.ts (or .js) file, add an icon property to your workspace configuration:

import {defineConfig} from 'sanity'
import {MyCustomLogo} from './components/MyCustomLogo'

export default defineConfig({
  name: 'default',
  title: 'My Project',
  projectId: 'your-project-id',
  dataset: 'production',
  
  // Add your custom icon/logo here
  icon: MyCustomLogo,
  
  plugins: [
    // your plugins
  ],
  
  schema: {
    types: [
      // your schema types
    ],
  },
})

Your logo component should be a React component that returns an SVG or other image element:

// components/MyCustomLogo.tsx
export function MyCustomLogo() {
  return (
    <img 
      src="/path-to-your-logo.svg" 
      alt="My Company Logo"
      style={{width: '100%', height: '100%'}}
    />
  )
}

Important note: The old approach using studio.components.logo no longer works as of Studio v3.23.0. If you're using multiple workspaces, you can set a different icon for each workspace by adding the icon property to each workspace object in your configuration array.

The icon appears in the top-left corner of your Studio interface where the Sanity logo normally appears. For more details on Studio configuration options, check out the Configuration API documentation.

Show original thread
9 replies
I believe studio.components.logo in your sanity.config.ts file lets you do this.
It seems like it doesn't want to change
Sorry, but I can’t tell much from that. Is that in your Studio or your login page? How have you configured your config file?
logo
will probably need to point at a component that exports an image.
Its the login form. I am doing that but nothing is changing
For the login page icon, please try using
icon
at the top level of
defineConfig()
in your config file: E.g.,

// sanity.config.tsx

const Logo = () => (
  // <svg>...</svg>
);

// ...

export default defineConfig({
  name: 'My Project',
  icon: Logo,
  // ...
});
Nothing wants to change it
I just tested
icon
and it worked, albeit after a refresh or two. If you can give some more details about what you’re trying, we can try to help you further.
Must be a caching issue or something cause now it works when I changed nothing

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Was this answer helpful?