Typography

Larastrap provides a generic utility component called x-larastrap::t , able to be rendered as any preferred HTML tag type.

a simple span
<x-larastrap::t node="span">a simple span</x-larastrap::t>
<span id="basenode-a87ff679a2f3e71d9181a67b7542122c" class="">a simple span</span>

Of course this is not meant to be directly used in templates - as it would be tedious and unconvenient to write so much code just to open and close a span - but is considered a base to define your own Custom Elements, so to define the typography style of your whole application and keep it consistent through the centralized configuration.

On this website, references to Larastrap components , parameters and examples of values are defined once in the global configuration as Custom Elements.

[
    'customs' => [
        'element' => [
            'extends' => 't',
            'params' => [
                'classes' => ['text-danger'],
                'node' => 'strong',
            ]
        ],

        'value' => [
            'extends' => 't',
            'params' => [
                'node' => 'code',
            ]
        ],

        'parameter' => [
            'extends' => 't',
            'params' => [
                'node' => 'strong',
            ]
        ]
    ]
]
<p>
    On this website, references to <x-larastrap::element>Larastrap components</x-larastrap::element>, <x-larastrap::parameter>parameters</x-larastrap::parameter> and <x-larastrap::value>examples of values</x-larastrap::value> are defined once in the global configuration as Custom Elements.
</p>
<p>
  On this website, references to <strong id="basenode-da895df07919549d278eb1959aa3007d" class="text-danger">Larastrap components</strong> , <strong id="basenode-d3d9446802a44259755d38e6d163e820" class="">parameters</strong> and <code id="basenode-6512bd43d9caa6e02c990b0a82652dca" class="">examples of values</code> are defined once in the global configuration as Custom Elements.
</p>

x-larastrap::t can be used to handle, among the other, classic Bootstrap Alerts and Badges: get a look to the page of Custom Elements Examples.

obj / name

x-larastrap::t is a Container, and an obj can be assigned (or inherited), but it also sports a few other parameters that permits you to display the value from a named attribute of the object (eventually: an Eloquent model) directly within the textual node

  • name - same as in Inputs, define the name of the attribute to access
  • prelabel / postlabel - same as in Buttons, permit to prepend or append an arbitrary text
everette14@example.org
@php
$user = App\Models\User::inRandomOrder()->first();
@endphp

<x-larastrap::t :obj="$user" name="email" />
<span id="basenode-45b9421d9d9ea23f723738fbf3debb53" class="">lincoln.davis@example.net</span>

In this case, also, it is possible to define your own Custom Elements to always display the same attribute with the same style, decorations, addictional graphics and more.

Dr. Darrin Hamill

lincoln.davis@example.net

Amaya Beer

vwisozk@example.com

Prof. Ethan Schmitt III

ashly77@example.org

[
    'customs' => [
        'ctitle' => [
            'extends' => 't',
            'params' => [
                'node' => 'h5',
                'classes' => ['card-title'],
                'name' => 'name',
            ]
        ],
        'cmail' => [
            'extends' => 't',
            'params' => [
                'node' => 'p',
                'classes' => ['card-text'],
                'name' => 'email',
                'prelabel' => '<i class="bi bi-envelope"></i> '
            ]
        ],
    ]
]
@php
$users = App\Models\User::inRandomOrder()->take(3)->get();
@endphp

<div class="card-group">
    @foreach($users as $user)
        <x-larastrap::enclose :obj="$user">
            <div class="card">
                <div class="card-body">
                    <x-larastrap::ctitle />
                    <x-larastrap::cmail />
                </div>
            </div>
        </x-larastrap::enclose>
    @endforeach
</div>
<div class="card-group">
  <div class="card">
    <div class="card-body">
      <h5 id="basenode-1019817e50f26ef213811645e0b27615" class="card-title">
        Carolyne Bradtke
      </h5>
      <p id="basenode-cb8cfbaaf3cda635d8c8c6b8b7aed23d" class="card-text">
        wisoky.dax@example.org
      </p>
    </div>
  </div>
  <div class="card">
    <div class="card-body">
      <h5 id="basenode-423b01842d1eb03d9b1c420939f1428b" class="card-title">
        Dr. Pasquale Borer IV
      </h5>
      <p id="basenode-ce0d7740f8f55b09c5af945c6aeb9f23" class="card-text">
        everette14@example.org
      </p>
    </div>
  </div>
  <div class="card">
    <div class="card-body">
      <h5 id="basenode-c2386feddceecbb7c568f9b432a69d90" class="card-title">
        Dr. Darrin Hamill
      </h5>
      <p id="basenode-aed8ce6b10e6a687eed6d735d7ede021" class="card-text">
        lincoln.davis@example.net
      </p>
    </div>
  </div>
</div>

Larastrap