Sha256: 50ba5ce5ad3589b28b4ce2fd4316631de65a0356273a94c4159d724945b72134

Contents?: true

Size: 1.26 KB

Versions: 3

Compression:

Stored size: 1.26 KB

Contents

# Customizing the Menu

You are allowed to add your custom links to the main navigation. To do so, you can access `SolidusAdmin::Config.menu_items` in an initializer:

```ruby
# config/initializers/solidus_admin.rb
SolidusAdmin::Config.menu_items << {
  key: :my_custom_link,
  route: :my_custom_link_path,
  icon: "24-hours-fill",
  position: 80
}
```

- The key you provide will be used to translate the link's label under the
`solidus_admin.menu_item.#{key}` key.
- Icon needs to be an icon name from [Remixicon](https://remixicon.com/).
- Position tells Solidus where to place the link in the main navigation. The
 default items are placed with 10 points of difference between them.

For nested links, you can provide a `children:` option with an array of hashes:

```ruby
# config/initializers/solidus_admin.rb
SolidusAdmin::Config.configure do |config|
  config.menu_items << {
    key: :my_custom_link,
    route: :my_custom_link_path,
    icon: "24-hours-fill",
    position: 80,
    children: [
      {
        key: :my_custom_nested_link,
        route: :my_custom_nested_link_path,
        position: 80
      }
    ]
  }
end
```

Your custom link will be rendered in the active state when its base path (i.e, the path without the query string) matches the one for the current url.

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
solidus_admin-0.3.2 docs/menu_items.md
solidus_admin-0.3.1 docs/menu_items.md
solidus_admin-0.3.0 docs/menu_items.md