npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@dkani/obsidian-settings-ui

v1.0.4

Published

Reusable UI components for Obsidian plugin settings

Downloads

10

Readme

Obsidian Settings UI

A lightweight helper library for building consistent, grouped, and dynamic settings UIs in Obsidian plugins.

✨ Features

  • ✅ Automatically renders settings UI based on SettingsConfig interface definition
  • ✅ Type-safe with your plugin’s Settings interface
  • ✅ Supports all obsidian input elements
  • ✅ Add new input elements like RadioGroup, ColorPicker, ColorDropdown
  • ✅ Supports grouped sections
  • ✅ Optional “How to use” section
  • ✅ Automatic binding to your plugin's settings object
  • ✅ Add localization functionality
  • ✅ Add conditional rendering and more ...

📦 Installation

In your plugin project:

pnpm add @dkani/obsidian-settings-ui

The library uses many styles to achieve the desired look and feel. To avoid conflicts with other plugins or with Obsidian itself, all styles must be prefixed with the plugin's ID. This is handled by the inject-prefixed-styles script. To inject the styles, you first need to install the following packages:

pnpm add --save-dev tsx postcss postcss-prefix-selector

In your package.json create a new script entry:

"scripts": {
  "inject:styles": "node node_modules/@dkani/obsidian-settings-ui/dist/scripts/inject-prefixed-styles.js",     
},

then run

pnpm inject:styles

This will insert (if you run it again, it will update) a section of styles needed by the obsidian-settings-ui.

🧱 Creating Setting Panel

Now that we've installed the necessary packages and styles, we can begin creating our settings panel.

Let's assume we have a plugin class called ReposPlugin. In this class, we need:

export default class ReposPlugin extends Plugin {
    settings: ReposPluginSettings;
    async onload() {
        await this.loadSettings();
        ...
        this.addSettingTab(new ReposPluginSettingTab(this));
        ...
    }
    async loadSettings() {
        this.settings = Object.assign({}, DEFAULT_SETTINGS, await this.loadData());
    }
}

Next, in the corresponding settings tab class (ReposPluginSettingTab):

export class ReposPluginSettingTab extends PluginSettingTab {
  renderer: Renderer<ReposPluginSettings>;
  constructor(private plugin: ReposPlugin) {
    super(plugin.app, plugin);
    this.renderer = new Renderer(plugin, plugin.settings, DEFAULT_SETTINGS, this);
  }

  async display(): Promise<void> {
    this.containerEl = await this.renderer.display(this.containerEl, this._getConfig());
  }

  private _getConfig(): SettingsConfig<ReposPluginSettings> {
    return {
      elements: [
        {
          type: 'SettingGroup',
          id: 'settingGroup.access',
          label: 'Access',
          items: [
            {
              type: 'Textfield',
              path: 'github_token',
              label: 'GitHub Token',
            },
          ],
        },
      ],
    };
  }
}

Explanation:

The display(...) method of the Renderer instance takes the current container and your settings configuration object, evaluates all contained conditions, and renders the result into a new container. This approach helps avoid flickering during refreshes. Finally, the new container is returned and displayed by Obsidian.

Refer to the SettingConfig documentation for more information.

📜 License

MIT — use freely, modify, and contribute back!

Made with ❤️ for Obsidian developers.