Custom Creative Tabs
Creative Tabs, also known as Item Groups, are the tabs in the creative inventory that store items. You can create your own creative tab to store your items in a separate tab. This is pretty useful if your mod adds a lot of items and you want to keep them organized in one location for your players to easily access.
Creating the Creative Tab
Adding a creative tab is pretty simple. Simply create a new static final field in your items class to store the creative tab and a resource key for it. You can then use FabricItemGroup.builder to create the tab and add items to it:
java
public static final ResourceKey<CreativeModeTab> CUSTOM_CREATIVE_TAB_KEY = ResourceKey.create(
BuiltInRegistries.CREATIVE_MODE_TAB.key(), Identifier.fromNamespaceAndPath(ExampleMod.MOD_ID, "creative_tab")
);
public static final CreativeModeTab CUSTOM_CREATIVE_TAB = FabricItemGroup.builder()
.icon(() -> new ItemStack(ModItems.GUIDITE_SWORD))
.title(Component.translatable("itemGroup.example-mod"))
.displayItems((params, output) -> {
output.accept(ModItems.SUSPICIOUS_SUBSTANCE);
output.accept(ModItems.POISONOUS_APPLE);
// The tab builder also accepts Blocks
output.accept(ModBlocks.CONDENSED_OAK_LOG);
output.accept(ModBlocks.PRISMARINE_LAMP);
// And custom ItemStacks
ItemStack stack = new ItemStack(Items.SEA_PICKLE);
stack.set(DataComponents.ITEM_NAME, Component.literal("Pickle Rick"));
stack.set(DataComponents.LORE, new ItemLore(List.of(Component.literal("I'm pickle riiick!!"))));
output.accept(stack);
})
.build();1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
java
// Register the group.
Registry.register(BuiltInRegistries.CREATIVE_MODE_TAB, CUSTOM_CREATIVE_TAB_KEY, CUSTOM_CREATIVE_TAB);1
2
2
You should see a new tab is now in the creative inventory menu. However, it is untranslated - you must add a translation key to your translations file - similarly to how you translated your first item.

Adding a Translation Key
If you used Component.translatable for the title method of the creative tab builder, you will need to add the translation to your language file.
json
{
"itemGroup.example-mod": "Example Mod"
}1
2
3
2
3
Now, as you can see, the creative tab should be correctly named:



