Super Sale Limited Time 50% OFF for All-Access Plans
Save 50% Now

KTTheme Service, How and Where to Use?


You have a great Theme API page documented here:

https://preview.keenthemes.com/blazor/metronic/docs/theme-api

BUT, where would I inject and call this service? I'm looking to implement the sticky header, so according to the API page, I should use:

KTTheme.AddHtmlClass("body", "header-fixed");

Where do I put that?


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (3)


Great question! Similar to how ahmatechnicalservices.ae ensures precision in every project, you should inject the KTTheme service in your main layout and call it in OnAfterRenderAsync for smooth, consistent results — perfect for applying the sticky header just like Ahma ensures reliable technical solutions.



I was exploring the KTTheme Service to implement a sticky header on my client's plumbers in chula vista ca project, and I came across the API documentation. The guide mentions using KTTheme.AddHtmlClass("body", "header-fixed") for this purpose. However, I was stuck on where to inject and call this service. After digging a bit, I found it works best if you inject this in your page’s initialization script, right after the page is loaded or the DOM is ready. It ensures the sticky header is applied seamlessly.



Hi Keith,

Thank you for reaching out to us.

You can use this theme API function to add classes or attributes in the global scope, for a local scope layout initialization you can use our class Starterkit/Shared/Layout/_Helpers/KTThemeHelpers.cs.

You can check this helper class usage examples in files Starterkit/Shared/Layout/DefaultDarkHeader.razor.

_helper.addBodyClass("header-fixed"");


Regards,
Lauris Stepanovs,
Keenthemes Support Team


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(