Skip to content
Brok UI

Loading…

No results

Stock Widget

Open source

Market cards — a single ticker with an area sparkline, a multi-ticker watchlist, and a price grid.

Preview

resources/views/blocks/stock-widget-grid.blade.php Blade
@props([
    'stocks' => [
        ['ticker' => 'AAPL', 'company' => 'Apple Inc.', 'price' => '262.82'],
        ['ticker' => 'CRM', 'company' => 'Salesforce, Inc.', 'price' => '307.46'],
        ['ticker' => 'SBUX', 'company' => 'Starbucks Corp.', 'price' => '86.09'],
        ['ticker' => 'TSLA', 'company' => 'Tesla Inc.', 'price' => '433.72'],
    ],
])

<x-ui.card class="w-full max-w-md p-6">
    <ul class="grid grid-cols-2 gap-6 sm:grid-cols-4">
        @foreach ($stocks as $stock)
            <li class="flex flex-col items-center justify-center gap-2 text-center">
                <x-ui.avatar :fallback="$stock['ticker']" :alt="$stock['company']" size="md" class="text-xs font-semibold" />
                <span class="text-xs font-medium text-muted-foreground">{{ $stock['ticker'] }}</span>
                <span class="text-base font-semibold tabular-nums text-foreground">${{ $stock['price'] }}</span>
            </li>
        @endforeach
    </ul>
</x-ui.card>

Installation

terminal
php artisan ui:add blocks/stock-widget-grid

Installs these dependencies automatically:

Registry contract

Install confidence

php artisan ui:add blocks/stock-widget-grid writes only the generated targets below. The CLI validates each file hash before writing and prompts before replacing local changes unless --force is used.

Version
1.0.3
License
open
Stability
stable
Contract
v1
Foundation
≥ 1.0.0
Type Generated target
blade resources/views/blocks/stock-widget-grid.blade.php

Registry dependencies

card avatar

Package dependencies

composer: jml/brok:^0.2

Use with AI

A brief for your coding agent: what the block is, the install command, how to render it, its props and the rules. Copy it, or open a prompt about this block in an assistant.

stock-widget-grid.md
# Brok UI block: Stock Grid Widget (`stock-widget-grid`)

Compact grid of stocks, each cell showing a circular monogram avatar, ticker, and current price.

Brok UI is a Laravel Blade registry. `ui:add` copies this block into the app as plain Blade the app owns; it composes installed `<brok:*>` primitives and semantic design tokens.

## Install

```bash
php artisan ui:add blocks/stock-widget-grid
```

## Render it

```blade
<x-blocks.stock-widget-grid />
```

## Props

- `stocks` (array, default `[…]`) — Ticker entries with company and price shown as grid cells.

## Use when

- Showing several stocks as a compact grid of ticker chips with a monogram avatar and price.
- Favouring a dense grid over a row list.

## Avoid when

- Wanting a list layout instead of a grid; use stock-widget-watchlist instead.

## Rules

- Render the installed block with `<x-blocks.stock-widget-grid />` and pass data through its props; edit the copied file only for structural changes.
- Keep the semantic design tokens (`bg-background`, `text-muted-foreground`); never swap in raw colour utilities.
- Keep the `data-slot` attributes and the logical (start/end) spacing so the markup still mirrors under `dir="rtl"`.

## Links

- Docs: https://brokui.dev/blocks/stock-widget-grid
- Registry JSON (files, props, contract): https://brokui.dev/r/open/blocks/stock-widget-grid.json

Working in Claude Code, Cursor or Codex? Give the agent the whole registry through the MCP server or the Brok UI skill.

Guidance

Use when

  • Showing several stocks as a compact grid of ticker chips with a monogram avatar and price.
  • Favouring a dense grid over a row list.

Avoid when

  • Wanting a list layout instead of a grid; use stock-widget-watchlist instead.

Anti-patterns

  • Do not replace semantic props with conflicting utility classes.
  • Do not remove labels, focus styles, or state attributes.

Usage

Render the block as a component, passing data where useful:

resources/views/welcome.blade.php Blade
<x-blocks.stock-widget-grid />

Built from primitives

Composes <brok:*> Semantic tokens Re-themeable RTL-ready

This block composes installed <brok:*> primitives and semantic design tokens only — it does not reimplement any primitive. Re-theme it (light, dark, admin, customer) by editing CSS variables; flip the preview to RTL to confirm it mirrors.

Source

The exact, editable file ui:add writes into your app. The preview above renders this same source — there are no preview-only blocks.

resources/views/blocks/stock-widget-grid.blade.php Blade
@props([
    'stocks' => [
        ['ticker' => 'AAPL', 'company' => 'Apple Inc.', 'price' => '262.82'],
        ['ticker' => 'CRM', 'company' => 'Salesforce, Inc.', 'price' => '307.46'],
        ['ticker' => 'SBUX', 'company' => 'Starbucks Corp.', 'price' => '86.09'],
        ['ticker' => 'TSLA', 'company' => 'Tesla Inc.', 'price' => '433.72'],
    ],
])

<x-ui.card class="w-full max-w-md p-6">
    <ul class="grid grid-cols-2 gap-6 sm:grid-cols-4">
        @foreach ($stocks as $stock)
            <li class="flex flex-col items-center justify-center gap-2 text-center">
                <x-ui.avatar :fallback="$stock['ticker']" :alt="$stock['company']" size="md" class="text-xs font-semibold" />
                <span class="text-xs font-medium text-muted-foreground">{{ $stock['ticker'] }}</span>
                <span class="text-base font-semibold tabular-nums text-foreground">${{ $stock['price'] }}</span>
            </li>
        @endforeach
    </ul>
</x-ui.card>

Ownership & lifecycle

Owner, release state, review evidence and adoption for this item.
Owner
Platform UI (@JoshJML)
Current version
1.0.3
Status
Stable
License
open
Deprecation
Not deprecated
Contract
v1
Foundation
≥ 1.0.0