The Matrix Lightning Web Component

The Matrix lightning web component interface makes it easy to enter and manage data quickly and efficiently. Similar to a spreadsheet, you can select cells, navigate using your keyboard, and enter or update values directly. You can also copy and paste data, highlight ranges, and use the drag handle to fill adjacent cells with just a few clicks. The intuitive design allows you to work faster and more accurately, even when handling large amounts of data.

Prerequisite: Lightning Web Security

The Matrix lightning web component requires that administrators have enabled Lightning Web Security in their environments. For details, view the following Salesforce Help support document: Lightning Web Security.

Using the Matrix

  • Select a cell by clicking it with your mouse or navigating to it using the arrow keys.
  • Begin typing to overwrite the existing value or double-click to edit the current value directly.
  • Press Enter to move to the cell below or Shift + Enter to move to the cell above.
  • Use Tab to move to the next cell to the right and Shift + Tab to move to the cell to the left.
Highlighting and Selecting
  • Click and drag your mouse to highlight a range of contiguous cells.
  • Non-contiguous ranges cannot be selected.
Drag to Fill
  • Use the handle at the bottom-right corner of a selected cell or range to drag and fill adjacent cells.
  • The dragged cells will replicate the original value (it does not apply a pattern or sequence).
Copy and Paste
  • Use standard keyboard shortcuts (Ctrl + C / Cmd + C to copy, Ctrl + V / Cmd + V to paste).
  • When pasting, the data will adjust to fit the selected area if there is enough space.
  • If the paste operation exceeds the available space (e.g., pasting 4 rows into a space with only 2 available rows), the data will be truncated.

Saving

When you make changes in the matrix, you’ll see a “You have unsaved changes” message in red at the top of the matrix. To save your changes:

  • Click the Save button (floppy disk icon) in the top-right corner of the matrix.
  • Once saved, the “You have unsaved changes” message will disappear.
How Data is Saved in Salesforce

The way data is saved depends on the selected View By setting:

View BySaving Behavior
Day or Time TrackingData is saved exactly as entered. If you enter 4 for a specific date and assignment, it will save 4 hours for that date.
Week or MonthData is distributed based on the work week settings.
For example, if you enter 20 in the week view and your work week is set to 5 days (Monday to Friday), the matrix will split the 20 hours into 4 hours per day.

Date Navigation

The Matrix interface includes a flexible date navigation system that allows you to control the time period displayed in the matrix. It includes several components:

Navigation Arrows
  • Use the left and right arrows to move backward or forward through time.
  • When you navigate beyond the current range of years, additional years will be dynamically added to the Year dropdown.
View By Dropdown

The View By dropdown determines the type of time period displayed in the matrix:

  • Day – Each column represents a day.
  • Week – Each column represents a week.
  • Month – Each column represents a month.
  • Single Week – Displays a single calendar week, where each column represents a day. When selected, the Week Options dropdown will appear.
Time Range Dropdown

The Time Range dropdown adjusts dynamically based on the selected View By option:

View ByTime Ranges
Single WeekWeek options are dynamically generated based on the selected month and year.
DayCurrent Month
Last 7 Days
Last 14 Days
Next 7 Days
Next 14 Days
WeekCurrent Quarter
1st Quarter
2nd Quarter
3rd Quarter
4th Quarter
Next 3 Months
Next 6 Months
1st Half
2nd Half
MonthNext 12 Months
Entire Year

Year Dropdown

The Year dropdown shows the current year, the previous three years, and the next five years. If you navigate beyond the available range using the arrows, new years will be added dynamically.

Week Options Dropdown

When in Single Week view, an additional dropdown will appear, showing available calendar weeks based on the selected month and year.

Switching Between Views and Time Ranges

The matrix will attempt to align the new view and time range based on the currently selected cell when switching views:

  • Week to Day View – If the selected cell is in the month of May and the user switches to Day view, the matrix will default to showing the days in May.
  • Month to Week View – If the selected cell is in November and the user switches to Week view, the matrix will default to showing the weeks in the 4th Quarter.
  • Month to Day View – If the selected cell is in November and the user switches to Day view, the matrix will default to showing the days in November.

When switching between fixed and rolling Time Ranges

  • If you switch from a fixed time range (e.g., 2nd Quarter) to a rolling time range (e.g., Next 3 Months), the matrix will use the selected date as the baseline.
  • For example, if the selected cell is in June within the 2nd Quarter and you switch to Next 3 Months, the matrix will display June as the starting point and show the following three months.

Adding the Matrix to a Lightning Page

You can easily add the Resource Hero Matrix component to any Lightning page:

  1. Go to SetupUser InterfaceLightning App Builder.
  2. Open the Lightning page where you want to add the Matrix, or create a new page.
  3. From the Components panel, search for RH Matrix and drag it onto the desired section of the page.
  4. Use the settings panel on the right side to adjust the available options. (See the table below for a list of available settings.)
  5. Save your changes and activate the page if needed.
Configuration Options

The following properties are available when configuring the LWC matrix:

NameDescriptionAvailable ValuesDefault
Header LabelThe label that appears at the top of the matrix.Any textResource Hero Matrix
Matrix TypeDetermines the type of dataSingle Record
RH Dashboard Standalone
Standalone
Default ViewBy / Time RangeSets the default time view and range.Single Week

Day – Current Month
Day – Last 7 Days
Day – Last 14 Days
Day – Next 7 Days
Day – Next 14 Days

Week – Current Quarter
Week – 1st Quarter
Week – 2nd Quarter
Week – 3rd Quarter
Week – 4th Quarter
Week – Next 3 Months
Week – Next 6 Months
Week – 1st Half
Week – 2nd Half

Month – Next 12 Months
Month – Entire Year
Week – Next 3 Months
Matrix Enabled FieldControls which field determines if a matrix is enabled.Picklist of fields from Resource Assignment objectRequired
Matrix Enabled FieldsManually sets which fields are enabled in the matrix.Comma-separated field namesNone
Sort By FieldField used to sort matrix rows.Any field from Resource Assignment objectresourceheroapp__assigned_to__c
Sort By OrderSort order for the matrix rows.ASC, DESCASC
Assignment Exclusion FieldField used to exclude records from the matrix.Any boolean field from Resource Assignment objectNone
Resource Assignment Field Set NameControls which field set is used for the matrix.Any field set from Resource Assignment objectNone
Component Max HeightMaximum height of the component in pixels.Integer300
Notes PanelDetermines the default state of the Notes panel.Default Open, Default Closed, HiddenDefault Closed
Show Grand Total RowShows or hides the grand total row at the bottom of the matrix.True, FalseTrue
Read OnlyMakes the matrix read-only.True, FalseFalse

Permissions and Access

  • The LWC Matrix follows the same permissions and field-level security as the Visualforce version.
  • To ensure proper access, make sure that users have read and edit permissions for the relevant objects and fields. If a user does not have access to a field or object, the matrix will respect those security settings and prevent data entry or visibility accordingly.

Related Support Posts

Ready to get started?

Schedule a call to see if Resource Hero is right for you

Book now