# Build a Standard Slot-Based Inventory

> For the complete documentation index, see [llms.txt](llms.txt).

Build a bag that holds six entries. A key takes one slot. A stack of bandages also takes one slot. Start with the player and registered assets from [First Steps](inv-first-steps.html).

Procedure: Give the player six slots

1. Open Container_Backpack, or create a Container Definition with that name. Give it the tag `Inventory.Container.Trait.Default`. Choose Simple Layout, set Slot Count Type to Property, and set Slots to six. Leave the item compatibility query empty so the bag accepts the test items.

2. On the player's Inventory Manager, set this bag as the only Initial Containers entry. Start with empty Initial Items and a fresh inventory for the capacity test.

3. Create an item such as a brass key. Add a Container Placement Fragment, a User Interface Fragment with an icon, and a Stack and Quantity Fragment. Use a Stack Limit of one and a Maximum Quantity of at least seven. Place seven single-key [pickups](inv-guide-inventory-items.html) in the level.

Procedure: Show all six slots in the player's menu

1. Create a Widget Blueprint based on `NinjaInventoryItemWidget`. Give it a visible slot background and an image for the item. Add an Inventory Item ViewModel with Manual creation. Follow the [item widget bindings](inv-ui-mvvm.html#bindings-with-the-item-widget) to pass the item, container, and position into the widget. Bind Get Icon Brush from the User Interface ViewModel to the image brush. Keep the slot background visible when the item is empty.

2. Create a second widget based on `NinjaInventoryContainerWidget`. In its Inventory settings, set Container Data Asset to Container_Backpack and enable Fill Empty Entries. Add an Inventory Container ViewModel with creation type Resolver and select Inventory Resolver. The base widget finds the player's bag.

3. Add a Wrap Box and choose Add ViewModel Extension. Set Entry Widget Class to your slot widget and Entry ViewModel to the Inventory Item ViewModel. Compile, then bind the container ViewModel's Get Items to the extension's Set Items. Add the bag widget to the owning player's menu.

![Container item list bound to Set Items on the panel extension](Documentation/inv_ui_mvvm_container_bindings.png)

For a pickup prompt that should say Bag full, call `EvaluatePlacementForDefinition` on the player's manager with the pickup entry. Check Can Store Any Amount before offering to collect it. For a drag preview over one particular slot, call the container's `CanAcceptItemAtPosition` with the item and destination position.

If a bag upgrade should unlock more slots, change its layout to Gameplay Attribute and select an initialized slot attribute such as `BackpackSlots` on the owner's ability system. The same slot widget works with the new capacity.

## Try It in Play

Open the empty bag and count six backgrounds. Collect six keys. Each gets its own icon. Try the seventh pickup while all six slots are occupied. The bag should still show six keys and the pickup should remain available. [Drop a key](inv-gameplay-abilities.html) if you configured it for dropping, or remove one with the Inventory Manager. Collect the remaining pickup and check that the empty slot fills again.

