Settings
Plugins can register settings without having to build any custom UI components. Settings automatically appear in the standard RemNote Settings UI and are automatically synced across devices.
Registering Settings
strings
async function onActivate(plugin: ReactRNPlugin) {
await plugin.settings.registerStringSetting({
id: "name",
title: "What is your name?",
defaultValue: "Bob",
});
});
You can also register multiline text settings by passing multiline: true
:
async function onActivate(plugin: ReactRNPlugin) {
await plugin.settings.registerStringSetting({
id: "name",
title: "What is your name?",
defaultValue: "Bob",
multiline: true,
});
});
numbers
async function onActivate(plugin: ReactRNPlugin) {
await plugin.settings.registerNumberSetting({
id: "age",
title: "What is your age?",
defaultValue: 20,
});
});
booleans
async function onActivate(plugin: ReactRNPlugin) {
await plugin.settings.registerBooleanSetting({
id: "trueOrFalse",
title: "True or False?",
defaultValue: false,
});
});
dropdowns
await plugin.settings.registerDropdownSetting({
id: "favorite-food",
title: "Favorite Food",
defaultValue: "pizza"
options: [{
key: "0",
label: "Pizza",
value: "pizza",
},
{
key: "1",
label: "Cake",
value: "cake",
}]
})
Getting Settings
Settings can be retrieved through plugin method calls or plugin hooks by passing the same id you used to register the setting.
const value = useTracker(
async (reactivePlugin) =>
await reactivePlugin.settings.getSetting('mySettingId'),
[],
);
const value = await plugin.settings.getSetting('mySettingId");