The Game's Interface
Around your story, every Monogatari game has an interface: the title screen with its menu, the bar of buttons under the text, and the screens those buttons open (saving, loading, settings and help). The starter game comes with all of it working. This page shows what each part is and how to change it.
Everything here is done by editing text files in your game folder: index.html, js/main.js, js/options.js and style/main.css. You don’t need to install anything. If you haven’t opened those files yet, start with Start Here.
The screens
A screen is one full view of the game: the title screen, the game itself, the settings. Only one shows at a time. Each has a name, which is what a button uses to open it.
| Screen | Name | What it shows |
|---|---|---|
| Loading | loading |
A progress bar while the game loads its images and sounds. |
| Language selection | language-selection |
The first time a game in several languages opens: a button for each language. See Translating Your Game. |
| Main | main |
The title screen and its menu. |
| Game | game |
The story: the scene, the characters, the text box and the quick menu. |
| Save | save |
A name for a new save, and the saves the player can overwrite. See Saving and Loading. |
| Load | load |
The saves the player can go back to. |
| Settings | settings |
The volumes, the text speed and the other player preferences. |
| Help | help |
What the quick menu buttons do, and the keyboard shortcuts. |
| Gallery | gallery |
The pictures the player has unlocked, when your game has gallery images. |
| Credits | credits |
The credits, when your game sets some. |


Where the screens come from
The screens are listed in index.html, inside the <visual-novel> element:
<div id="monogatari">
<visual-novel>
<language-selection-screen></language-selection-screen>
<loading-screen></loading-screen>
<main-screen>
<main-menu></main-menu>
</main-screen>
<game-screen>
<dialog-log></dialog-log>
<text-box></text-box>
<quick-menu></quick-menu>
</game-screen>
<gallery-screen></gallery-screen>
<credits-screen></credits-screen>
<load-screen></load-screen>
<save-screen></save-screen>
<settings-screen></settings-screen>
<help-screen></help-screen>
</visual-novel>
</div>Each of these tags is a component: a part of the interface the engine fills in. You don’t write the buttons of the settings screen; the engine does. Keep this block as it is. To leave a screen out of your game, remove the button that opens it (see Remove a button) and keep its tag.
The gallery screen takes itself out of the page when your game has no gallery images, and the credits screen stays empty until you set credits. Every built-in screen and menu has a page of its own in Components, with its markup and the classes you can style.
The menus
The game has two menus. Both are lists of buttons that your game can add to, remove from and reorder.
- The main menu is on the title screen. It has Start, Load, Settings and Help. The engine adds Gallery at the end when your game registers gallery images, and Credits when it sets credits.
- The quick menu is the bar at the bottom of the game screen while the story plays. It has Back, Hide, Log, Auto, Skip, Save, Load, Settings and Quit. Back only shows while the
AllowRollbacksetting istrue, and Skip only while theSkipsetting is above0. The starter game setsSkipto0, so Skip is hidden.
What the quick menu buttons do:
| Button | What it does |
|---|---|
| Back | Goes back one step in the story. |
| Hide | Hides the text box so the player can see the scene. The button then says Show, and pressing it brings the text box back. |
| Log | Opens the dialog log: the lines the player has read so far. |
| Auto | Turns auto-play on: the story moves on by itself, a few seconds after each line finishes. While it runs, the button says Stop. |
| Skip | Moves through the story quickly, for lines the player has read before. Pressing it again stops. It waits at choices. |
| Save | Opens the save screen. |
| Load | Opens the load screen. |
| Settings | Opens the settings screen. |
| Quit | Asks “Do you want to quit?”, then ends the game and goes back to the title screen. |
Skip only shows when the Skip setting is above 0: the number is how many milliseconds each line stays while skipping. Text, Skip and Auto-play has the details.
Where menu changes go
Change the menus in js/main.js, inside the init function: the part the file marks with “3. Inside the init function”. By then the engine has set the menus up, including the buttons it adds on its own.
$_ready(() => {
// 2. Inside the $_ready function:
monogatari.init('#monogatari').then(() => {
// 3. Inside the init function:
// Your menu changes go here
});
});The menu methods also work earlier, above $_ready or in js/script.js, and the menus show the change when they first appear. The init function is still the place for a change that names Gallery or Credits: the engine adds those two buttons when the game starts, so before that there’s nothing to remove or to add a button after. Before 2.9.0, a menu change above $_ready stopped the game from starting, so a game that must run on an older version keeps its menu changes inside init.
Each button is named by its label key: the word in its string property, like Start or Settings. The menus use these names to find buttons. The quick menu’s names are Back, Hide, Log, AutoPlay, Skip, Save, Load, Settings and Quit. The buttons the engine adds to the main menu are Gallery and Credits.
Remove a button
monogatari.component('main-menu').removeButton('Help');
monogatari.component('quick-menu').removeButton('Quit');The first line takes Help off the main menu. The second takes Quit off the quick menu, which suits a game played in a browser tab, where the player closes the tab to stop.
Add a button
A button needs a label and something to do. This one goes on the main menu, after Load, and opens the settings screen:
monogatari.component('main-menu').addButtonAfter('Load', {
string: 'Options',
data: {
action: 'open-screen',
open: 'settings',
},
});stringis the label key. The text the player reads comes from the game’s translations, so add the key there too, above$_readyinjs/main.js:monogatari.translation('English', { 'Options': 'Options', });Add it to every language your game offers. A key with no text in the player’s language shows the English text, and one no language has shows a button that says “undefined”; while you develop, either opens an error dialog that says
Translation for string "Options" could not be found.databecomes the button’sdata-attributes.action: 'open-screen'withopen: 'settings'opens the screen namedsettings; any name from the screens table works.icon(optional) puts an icon before the label, named with the classes of a free Font Awesome icon, likeicon: 'fas fa-globe'. The quick menu’s buttons all have one. See Icons.
addButton() adds the button at the end of the menu, and addButtonBefore('Settings', { … }) puts it before another button. When the button named in addButtonAfter() or addButtonBefore() isn’t in the menu, nothing is added.
Make a button run your own code
data.action names a listener: a function the engine runs when the player presses an element with that action. Register one with monogatari.registerListener(), above $_ready in js/main.js, then point a button at it. This main menu button opens your game’s website in a new tab:
monogatari.translation('English', {
'Website': 'Website',
});
monogatari.registerListener('open-website', {
callback: () => {
window.open('https://example.com', '_blank');
},
});And inside the init function:
monogatari.component('main-menu').addButton({
string: 'Website',
icon: 'fas fa-globe',
data: {
action: 'open-website',
},
});Reorder the buttons
To move a button, remove it and add it back where you want it. This puts Load before Start:
const mainMenu = monogatari.component('main-menu');
mainMenu.removeButton('Load');
mainMenu.addButtonBefore('Start', {
string: 'Load',
data: {
action: 'open-screen',
open: 'load',
},
});The Main Menu and Quick Menu pages list every built-in button with its data and icon, so you can add one back exactly as it was.
Rename a button
To change what a button says, change the text of its label key. This makes the Start button say New Game, everywhere the Start key is used:
monogatari.translation('English', {
'Start': 'New Game',
});Put it above $_ready in js/main.js. For a game in several languages, do it for each one.
The title screen

Add a title
The starter game’s title screen has no title. Add one as an <h1> inside <main-screen> in index.html, above the menu:
<main-screen>
<h1>After the Bell</h1>
<main-menu></main-menu>
</main-screen>The browser tab shows the <title> near the top of index.html, which is separate: change it too.
Give it a background picture
Put the picture in assets/ui/ (here, assets/ui/title.png) and add this to style/main.css:
[data-screen="main"] {
background-image: url('../assets/ui/title.png');
background-size: cover;
background-position: center;
}
[data-screen="main"] h1 {
color: #ffffff;
}The address is relative to style/main.css, so it starts with ../ to leave the style folder. The title’s text is dark gray by default, which is hard to read on a dark picture; the second rule makes it white. Pick the color that stands out from your picture.
Play music on it
Register the track as music in js/script.js and name it in the MainScreenMusic setting in js/options.js:
// js/script.js
monogatari.assets('music', {
'title-theme': 'title-theme.mp3',
});// js/options.js, inside monogatari.settings({ … })
'MainScreenMusic': 'title-theme',The file goes in assets/music/. The music loops while the title screen shows and stops when the game starts. Most browsers don’t play sound before the player has clicked somewhere on the page: when the browser blocks the title music, the game shows a bar at the top that says “Click here to allow audio playback”, and starts the music when the player clicks it.
Start without the title screen
Set 'ShowMainScreen': false in js/options.js. The game then starts the story as soon as it loads (after the splash screen, if your script has one). With no title screen, the Quit button starts the story again from the beginning.
The settings screen
The settings screen has the four volumes (music, sound effects, voices and videos), the text speed and the auto-play speed. A game in several languages adds a language choice, and a desktop app whose window keeps a fixed shape adds the window size (see Desktop). Every change is saved for the player’s next visit. On iPhones and iPads, the volumes are replaced by the message “Audio settings are not supported on iOS”, because the device’s own volume controls all sound there.

The values the game starts with are the player preferences in js/options.js (monogatari.preferences({ … })): the starting volumes, text speed and auto-play speed. See Player Preferences for each one. The text types out faster with the Text Speed slider further right.
To hide a setting, hide its row in style/main.css. Each row has a data-settings attribute: audio, text-speed, auto-play-speed, language and resolution. This hides the auto-play speed:
[data-settings="auto-play-speed"] {
display: none;
}Add a screen of your own
A screen of your own, such as an Extras page or a chapter list, takes three changes.
List it in
index.html, inside<visual-novel>next to the other screens, with what it shows. The tag name must contain a hyphen; the screen’s name is the tag without-screen, so<extras-screen>is theextrasscreen.<extras-screen> <button class="top left" data-action="back"><span class="fas fa-arrow-left"></span></button> <h2>Extras</h2> <p>Thank you for playing.</p> </extras-screen>The
data-action="back"button is the round arrow the built-in screens have. It goes back to the game when a game is being played, and to the title screen otherwise.Register it in
js/main.js, above$_ready:class ExtrasScreen extends Monogatari.ScreenComponent { static tag = 'extras-screen'; } monogatari.registerComponent(ExtrasScreen);Add a button that opens it, inside the
initfunction, with its label in the translations as in Add a button:monogatari.component('main-menu').addButtonAfter('Load', { string: 'Extras', data: { action: 'open-screen', open: 'extras', }, });
The screen opens over the whole game with the same look as the built-in ones. Anything inside it can be styled in style/main.css with [data-screen="extras"]. A screen that builds its content from code, like the gallery does, is a component of your own: see Extending Monogatari.

Keyboard shortcuts
These keys work while the story plays. None of them work while the player types in a text field, like the save name.
| Key | What it does |
|---|---|
| Space or → | Next line. |
| ← | Back one step (only while AllowRollback is true). |
| H | Hide or show the text box. |
| S | Start or stop skipping (only while the Skip setting is above 0). |
| Esc | Open the settings screen, and from the settings screen, go back to the game. |
| Shift + S | Open the save screen. |
| Shift + L | Open the load screen. |
| Shift + Q | Quit, after the player confirms. |
When the game allows skipping (Skip above 0), the help screen also lists S for it (see The menus). Auto-play has no key; before 2.9.0 the help screen listed an A key for it that did nothing.
On the menus, Tab moves between buttons and Enter presses one. Space doesn’t press a button: during the game it moves the story on instead, even when a quick menu button has the focus.
To turn a shortcut off, remove its listener inside the init function:
monogatari.unregisterListener('distraction-free');This turns off H. The other shortcuts you can remove this way are back (←) and end (Shift + Q). A listener runs for its button too, so removing one also stops the button with the same action: after the line above, the Hide button does nothing, so remove it from the quick menu as well. The help screen doesn’t change; it always shows the same list. Space, →, Esc, Shift + S and Shift + L aren’t listeners and can’t be removed.
Change how it all looks
The colors, fonts, spacing and shapes of every screen come from the engine’s styles, and you change them in style/main.css: see Style and Design.
Related
- Saving and Loading: the save and load screens, and autosaves.
- Translating Your Game: the language selection screen and the menus in other languages.
- Accessibility: keyboard play, text speed, reduced motion.
- Configuration:
ShowMainScreen,MainScreenMusic,AllowRollback,Skipand every other setting. - Components: each screen and menu in detail.