From the contributor
How to use this sample
Summary
This sample demonstrates how to create a clickable rating experience in the view Tile mode. It allows users to rate the item/document when in the tile mode.

View requirements
Create a list using the template Recipe Tracker

Enabling the ratings feature (Only communication site)
The ratings feature is available by default in the team site, but not in the communication site. If you want to use the ratings feature in the list of communication sites, you need to enable the feature GUID 915c240e-a6cc-49b8-8b2c-0bff8b553ed3. The following is an example of how to enable it using PnP PowerShell.
$targetURL = "https://<tenent name>.sharepoint.com/sites/<site name>"
Connect-PnPOnline -Url $targetURL -Interactive
Enable-PnPFeature –identity 915c240e-a6cc-49b8-8b2c-0bff8b553ed3 -Scope site
Disconnect-PnPOnline
Add a ratings feature to the list
Click gear icon
Click List Settings
Under General Settings, click Rating Settings.

Under Rating Settings, click Yes.
Under Which voting/rating experience you would like to enable for this list?, click Rating.
Click OK.

Adding rating fields to the default view
The following is an example of how to add the rating related fields to the default view using PnP PowerShell.
$targetURL = "https://<tenant name>.sharepoint.com/sites/<site name>"
$listName = "<list title>" # Recipe Tracker
Connect-PnPOnline -Url $targetURL -Interactive
$list = Get-PnPList -Identity $listName
$list.DefaultView.ViewFields.Add("RatingCount")
$list.DefaultView.ViewFields.Add("Ratings")
$list.DefaultView.ViewFields.Add("RatedBy")
$list.DefaultView.Update()
Invoke-PnPQuery
After this the default view should look like:

Sample
| Solution | Author(s) |
|---|---|
| rating-in-tiles.json | Luís Ribeiro |
Version history
| Version | Date | Comments |
|---|---|---|
| 1.0 | October 22, 2023 | Initial release |
Disclaimer
THIS CODE IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
Additional notes
None