# Sandbox.BaseInventoryComponent.Add

```csharp
bool Add(BaseInventoryItem item, int slot = -1)
```

Adds an already-spawned item to the inventory. Slot -1 picks one: the item's
[Sandbox.BaseInventoryItem.PreferredSlot](/api/Sandbox.BaseInventoryItem/PreferredSlot) when free, otherwise the first empty slot
(buckets always take the preference). Host only. The item is reparented under this inventory
and disabled until switched to.

### Parameters

- `item` (`BaseInventoryItem`)
- `slot` (`int`), default `-1`

### Returns

`bool`

Declared in [Sandbox.BaseInventoryComponent](/api/Sandbox.BaseInventoryComponent).
Assembly: `Sandbox.Engine`.
