Table

An example of a simple data table

Show
entries
First Name Last Name GPA

Displaying 1 to 0 of 0

  • / 0

app/components/student_table_component.rb

class StudentTableComponent < ViewComponent::Base
  def columns
    [
      {
        header: "First Name",
        accessor: :first_name
      },
      {
        header: "Last Name",
        accessor: :last_name
      },
      {
        header: "GPA",
        accessor: ->(model) { model.gpa.round(2) },
        column: :gpa,
        type: :input
      }
    ]
  end
end