Module: BetterUi::General::Components::Table::TableHelper

Included in:
ApplicationHelper
Defined in:
app/helpers/better_ui/general/components/table/table_helper.rb

Instance Method Summary collapse

Instance Method Details

#bui_table(**options, &block) ⇒ String

Renderizza un componente Table per visualizzare dati strutturati in formato tabellare.

Examples:

Tabella base con intestazioni e righe

<%= bui_table(headers: ['Nome', 'Email'], rows: [['Mario Rossi', '[email protected]']]) %>

Tabella con righe alternate e bordi

<%= bui_table(headers: ['ID', 'Prodotto', 'Prezzo'], 
             rows: [[1, 'Scarpe', '€80'], [2, 'Camicia', '€40']], 
             striped: true, bordered: true) %>

Tabella con stile personalizzato

<%= bui_table(headers: ['Data', 'Evento'], 
             rows: [['10/01/2023', 'Riunione'], ['15/01/2023', 'Scadenza']], 
             theme: :blue, size: :large, hover: true) %>

Tabella responsiva per dispositivi mobili

<%= bui_table(headers: ['Prodotto', 'Descrizione', 'Prezzo', 'Disponibilità'], 
             rows: [...], 
             responsive: true) %>

Tabella con attributi HTML personalizzati

<%= bui_table(headers: ['Nome', 'Email'], 
             rows: [['Mario Rossi', '[email protected]']], 
             id: 'users-table', 'data-sortable': true) %>

Parameters:

  • headers (Array<String>)

    Intestazioni delle colonne della tabella

  • rows (Array<Array>)

    Dati delle righe della tabella

  • striped (Boolean)

    Applica righe alternate con colori diversi

  • bordered (Boolean)

    Aggiunge bordi alla tabella

  • hover (Boolean)

    Aggiunge effetto hover sulle righe

  • responsive (Boolean)

    Rende la tabella responsiva (scrollabile orizzontalmente)

  • compact (Boolean)

    Riduce la spaziatura interna

  • theme (Symbol)

    Tema della tabella (:default, :white, :gray)

  • size (Symbol)

    Dimensione della tabella (:small, :medium, :large)

  • rounded (Symbol)

    Arrotondamento degli angoli (:none, :small, :medium, :large)

  • classes (String)

    Classi CSS aggiuntive

  • options (Hash)

    Attributi HTML aggiuntivi

Returns:

  • (String)

    HTML della tabella renderizzata



46
47
48
# File 'app/helpers/better_ui/general/components/table/table_helper.rb', line 46

def bui_table(**options, &block)
  render BetterUi::General::Table::Component.new(**options), &block
end