Custom Detail in Salesforce Chat

The Custom Detail is displayed to agents in the footer widget and in the Chat Details page in the Salesforce Console while the chat is active. So, the Custom Details will be displayed only when the chat is active.
Reference Article:

It is not currently supported in Lightning Experience. You can vote for this idea.

You can create fields in Chat Transcript object. In the Pre-chat Visualforce page, you can use saveToTranscript() to store the values directly on the Chat Transcript record.
Sample code:
liveagent.addCustomDetail('Company', 'Acme').saveToTranscript('Company__c');