Skip to content

How to make the component Icon appear on the same line. #1791

Answered by HiDeoo
vhtmui asked this question in Q&A
Discussion options

You must be logged in to vote

👋 You should be able to target the specific icons you wish to display inline by passing a custom CSS class to the icon component:

text <Icon name="star" class="inline-icon />

Then, you would need to add custom CSS styles for this new class by specifying a path to a CSS file in astro.config.mjs:

export default defineConfig({
  integrations: [
    starlight({
      title: 'Your docs',
      customCss: [
+        // Relative path to your custom CSS file.
+        './src/styles/custom.css',
      ],
    }),
  ],
});

And in src/styles/custom.css, add a style for the .inline-icon class to display the icon inline:

.sl-markdown-content .inline-icon {
  display: inline;
}

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@vhtmui
Comment options

@HiDeoo
Comment options

@vhtmui
Comment options

Answer selected by vhtmui
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants