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

# Items

Basic inventory management for items the player owns.




**About this demo**

The demo signs in automatically with an anonymous account. The account is shared across every demo in the showroom, so items and currency you get in one demo carry over to the others. Loading takes a moment. If the frame is too small, open the demo in a new tab.

## Overview

The page lists how many of three items (`potion`, `ether`, `elixir`) you hold and lets you gain or spend each one at a time. It shows that each item is counted separately, and that the spend button is disabled for an item you have none of.

## How to try it

1. **Your items** lists three items, and **Stock** shows each name and count, e.g. **potion x0**. Every item starts at 0.
1. For an item you have none of, **Spend** is disabled.
1. Press **Gain** on any item; only that item's count goes up by 1, and its **Spend** becomes available.
1. Press **Spend** to use one; the count goes down by 1. Back at 0, **Spend** is disabled again.

## GS2 services used

- [GS2-Inventory](/microservices/inventory/): A GS2-Inventory simple inventory defines the three items `potion`, `ether`, and `elixir`, and holds each player's count of each.
- [GS2-Exchange](/microservices/exchange/): GS2-Exchange rates define, per item, the transaction behind **Gain** (acquire one) and **Spend** (consume one), executed server-side automatically.

## Use it in GS2 Studio

In GS2 Studio's Simple mode, open **Add features** and press **Add** on **Items** to bring this feature into your own project. To point at the package directly, choose **Add from GitHub** and enter the package below.

```text
https://github.com/gs2io/gs2-studio-package/tree/main/foundation-economy-inventory/packages/foundation-economy-inventory
```

- Owner: `gs2io`
- Repository: `gs2-studio-package`
- Subdirectory: `foundation-economy-inventory/packages/foundation-economy-inventory`

## Source code

- Demo project: <https://github.com/gs2io/gs2-studio-package/tree/main/foundation-economy-inventory/live-demo>
- Feature package: <https://github.com/gs2io/gs2-studio-package/tree/main/foundation-economy-inventory>



