# Attributes

Source: https://developers.swell.is/frontend-api/attributes

**Swell.js:**

Retrieve product attributes to display in  storefront.

### List attributes

*Returns a list of product attributes, with offset pagination using* *`limit`* *and* *`page`**.*

**List attributes**

**swell.js**

```- Select a language -
await swell.attributes.list({
  limit: 25,
  page: 1
})
```

### Get an attribute

*Returns a single attribute.*

**Get an attribute**

**swell.js** `By slug`

```javascript
await swell.attributes.get('color')
```

**swell.js** `By ID`

```javascript
await swell.attributes.get('5c15505200c7d14d851e510g')
```

**GraphQL:**

Retrieve product attributes to display in a storefront.

### List attributes

Returns a list of product attributes, with offset pagination using `limit` and `page`.

The parameters for this query are `search`, `where`, `sort`, `limit`, `page`, `_locale`, and `_currency`.

**List attributes**

**GraphQL**

```graphql
# Returns 5 attributes per page, starting on page 1.
query getAttributes {
  attributes(limit: 5, page: 1) {
    count
    results {
      name
      visible
      type
      values
    }
  }
}
```

### Get an attribute

Returns a single attribute by ID.

The parameters for this query are `id`, `_locale`, and `_currency`.

**Get an attribute**

**GraphQL**

```graphql
# Returns all values entered in the 'color' attribute.
query getAttributeById {
  attributeById(id: "color") {
    name
    visible
    type
    values
  }
}
```
